diff --git a/ha-capturing-notes.org b/ha-capturing-notes.org index 74aebe6..b6d8535 100644 --- a/ha-capturing-notes.org +++ b/ha-capturing-notes.org @@ -320,23 +320,23 @@ The =en= script is used as the last pipe entry on the command line, this display * Keybindings Along with kicking off the org-capture, I want to be able to clock-in and out: #+BEGIN_SRC emacs-lisp - (general-evil-define-key 'normal org-mode-map - :prefix "SPC m" - "X" 'org-capture - "c" '(:ignore t :which-key "clocks") - "c i" '("clock in" . org-clock-in) - "c l" '("clock in last" . org-clock-in-last) - "c o" '("clock out" . org-clock-out) - "c c" '("cancel" . org-clock-cancel) - "c d" '("mark default task" . org-clock-mark-default-task) - "c e" '("modify effort" . org-clock-modify-effort-estimate) - "c E" '("set effort" . org-set-effort) - "c g" '("goto clock" . org-clock-goto) - "c r" '("resolve clocks" . org-resolve-clocks) - "c R" '("clock report" . org-clock-report) - "c t" '("eval range" . org-evaluate-time-range) - "c =" '("timestamp up" . org-clock-timestamps-up) - "c -" '("timestamp down" . org-clock-timestamps-down)) + (with-eval-after-load 'ha-org + (ha-org-leader + "X" '("org capture" . org-capture) + "c" '(:ignore t :which-key "clocks") + "c i" '("clock in" . org-clock-in) + "c l" '("clock in last" . org-clock-in-last) + "c o" '("clock out" . org-clock-out) + "c c" '("cancel" . org-clock-cancel) + "c d" '("mark default task" . org-clock-mark-default-task) + "c e" '("modify effort" . org-clock-modify-effort-estimate) + "c E" '("set effort" . org-set-effort) + "c g" '("goto clock" . org-clock-goto) + "c r" '("resolve clocks" . org-resolve-clocks) + "c R" '("clock report" . org-clock-report) + "c t" '("eval range" . org-evaluate-time-range) + "c =" '("timestamp up" . org-clock-timestamps-up) + "c -" '("timestamp down" . org-clock-timestamps-down))) #+END_SRC * Technical Artifacts :noexport: diff --git a/ha-config.org b/ha-config.org index 9839432..6ae499a 100644 --- a/ha-config.org +++ b/ha-config.org @@ -347,7 +347,11 @@ I'm not trying an experiment where specially-placed function keys on my fancy er :keymaps '(normal visual) :prefix "SPC" :non-normal-prefix "M-SPC" - :global-prefix "")) + :global-prefix "") + + (general-create-definer ha-local-leader + :states '(normal visual) + :prefix "SPC m")) #+END_SRC *** Top-Level Operations Let's try this general "space" prefix by defining some top-level operations, including hitting ~space~ twice to bring up the =M-x= collection of functions: diff --git a/ha-email.org b/ha-email.org index c762563..62f39c6 100644 --- a/ha-email.org +++ b/ha-email.org @@ -626,8 +626,8 @@ The gods ordained that Mail and Org should dance together, so step one is compos #+BEGIN_SRC emacs-lisp (use-package org-mime :config - (general-evil-define-key 'normal notmuch-message-mode-map - :prefix "SPC m" + (ha-local-leader + :keymaps 'notmuch-message-mode-map "s" '("send" . notmuch-mua-send-and-exit) "m" '("mime it" . org-mime-htmlize))) #+END_SRC diff --git a/ha-org-clipboard.org b/ha-org-clipboard.org index d4ae6ce..4bda7d3 100644 --- a/ha-org-clipboard.org +++ b/ha-org-clipboard.org @@ -165,9 +165,8 @@ The heavy lifting, however is done by this function. Note that I will need anoth * Keybinding to Paste into Org Files We just need to bind it to the /local/ mode key sequence: #+BEGIN_SRC emacs-lisp -(general-evil-define-key 'normal org-mode-map - :prefix "SPC m" - "y" 'ha-org-yank-clipboard) + (with-eval-after-load 'ha-org + (ha-org-leader "y" 'ha-org-yank-clipboard)) #+END_SRC * Technical Artifacts :noexport: diff --git a/ha-org-publishing.org b/ha-org-publishing.org index 5d9172a..42b5b1c 100644 --- a/ha-org-publishing.org +++ b/ha-org-publishing.org @@ -165,18 +165,18 @@ Another helper function for the content of website is to make sure to update =in * Keybindings Make it easy to publish all or just some of my website: #+BEGIN_SRC emacs-lisp - (general-evil-define-key 'normal org-mode-map - :prefix "SPC m" + (with-eval-after-load 'ha-org + (ha-org-leader "p" '(:ignore t :which-key "publishing") "p a" '("all" . org-publish-all) - "p p" '("project" . org-publish-project)) + "p p" '("project" . org-publish-project))) #+END_SRC And let's put a /leader key/ sequence for my favorite file on my website: #+BEGIN_SRC emacs-lisp (ha-leader "f h" '(:ignore t :which-key "howards") - "f h w" '("website index" . (lambda () + "f h i" '("website index" . (lambda () (find-file (expand-file-name "index.org" "~/website"))))) #+END_SRC * Technical Artifacts :noexport: diff --git a/ha-org.org b/ha-org.org index bc65c81..b6384cb 100644 --- a/ha-org.org +++ b/ha-org.org @@ -33,16 +33,28 @@ Org is a /large/ complex beast with a gazillion settings, so I discuss these lat :init <> <> + :config + <> <> <> <> <> <> + <> <> <> <>) #+END_SRC + +One other helper routine is a =general= macro for org-mode files: +#+NAME: ha-org-leader +#+BEGIN_SRC emacs-lisp :tangle no + (general-create-definer ha-org-leader + :states '(normal visual) + :keymaps 'org-mode-map + :prefix "SPC m") +#+END_SRC * Initialization Section Org is an important part of my Emacs world, and with a lot of customization (even though Spacemacs and Doom do a good job getting things started). @@ -314,8 +326,7 @@ Keybindings available to all file buffers: Bindings specific to org files: #+NAME: org-keybindings #+BEGIN_SRC emacs-lisp :tangle no - (general-evil-define-key 'normal org-mode-map - :prefix "SPC m" + (ha-org-leader "e" '("exports" . org-export-dispatch) "l" '("insert link" . org-insert-link) "o" '("goto link" . ace-link-org) diff --git a/ha-programming.org b/ha-programming.org index 48be0ae..02895a3 100644 --- a/ha-programming.org +++ b/ha-programming.org @@ -26,6 +26,14 @@ A literate programming file for helping me program. * Introduction Seems that all programming interfaces and workflows behave similarly. However... + +One other helper routine is a =general= macro for org-mode files: +#+BEGIN_SRC emacs-lisp + (general-create-definer ha-prog-leader + :states '(normal visual) + :keymaps 'prog-mode-map + :prefix "SPC m") +#+END_SRC * General The following work for all programming languages. ** direnv @@ -125,15 +133,12 @@ I like =comment-dwim= (~M-;~), and I like =comment-box=, but I have an odd perso #+END_SRC And a keybinding: #+BEGIN_SRC emacs-lisp - (general-evil-define-key 'normal prog-mode-map - :prefix "SPC m" - "c" '("comment line" . ha-comment-line)) + (ha-prog-leader "c" '("comment line" . ha-comment-line)) #+END_SRC ** Evaluation Typical keybindings for all programming modes: #+BEGIN_SRC emacs-lisp - (general-evil-define-key 'normal prog-mode-map - :prefix "SPC m" + (ha-prog-leader "e" '(:ignore t :which-key "eval") "e ;" '("expression" . eval-expression) "e b" '("buffer" . eval-buffer) @@ -206,8 +211,7 @@ And, finally, we install [[https://github.com/k1LoW/emacs-ansible][Ansible]] as #+END_SRC And some special keybindings to encrypt/decrypt files: #+BEGIN_SRC emacs-lisp - (general-evil-define-key 'normal ansible-mode-map - :prefix "SPC m" + (ha-prog-leader "x" '(:ignore t :which-key "decryption") "x d" '("decrypt buffer" . ansible-decrypt-buffer) "x e" '("encrypt buffer" . ansible-encrypt-buffer)) @@ -288,9 +292,8 @@ finds at that point." And we just need to bind it. The following is Doom-specific: #+BEGIN_SRC emacs-lisp - (general-evil-define-key 'normal prog-mode-map - :prefix "SPC m" - "e c" '("current" . ha-eval-current-expression)) + (ha-prog-leader + "e c" '("current" . ha-eval-current-expression)) #+END_SRC *** Dim those Parenthesis The [[https://github.com/tarsius/paren-face][paren-face]] project lowers the color level of parenthesis which I personally find better.