Remove the use of the :general
But to use the (ha-leader), we need to add an :after general
This commit is contained in:
		
							parent
							
								
									65d21999b1
								
							
						
					
					
						commit
						a633b22275
					
				
					 5 changed files with 31 additions and 29 deletions
				
			
		| 
						 | 
				
			
			@ -33,6 +33,7 @@ Can not live without [[https://magit.vc/][Magit]], a Git porcelain for Emacs. I
 | 
			
		|||
    :ensure t)
 | 
			
		||||
 | 
			
		||||
  (use-package magit
 | 
			
		||||
    :after general
 | 
			
		||||
    ;; See https://github.com/magit/magit/wiki/Emacsclient for why we need to set:
 | 
			
		||||
    :custom (with-editor-emacsclient-executable "emacsclient")
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -105,6 +106,7 @@ Turning on the mode, as well as binding some new /leader/ keys:
 | 
			
		|||
 | 
			
		||||
#+BEGIN_SRC emacs-lisp
 | 
			
		||||
  (use-package diff-hl
 | 
			
		||||
    :after general
 | 
			
		||||
    :config
 | 
			
		||||
    (global-diff-hl-mode)
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
							
								
								
									
										50
									
								
								ha-evil.org
									
									
									
									
									
								
							
							
						
						
									
										50
									
								
								ha-evil.org
									
									
									
									
									
								
							| 
						 | 
				
			
			@ -350,14 +350,12 @@ I often use the Emacs commands, ~M-t~ and whatnot to exchange words and whatnot,
 | 
			
		|||
    (setq evil-exchange-key (kbd "gx")
 | 
			
		||||
          evil-exchange-cancel-key (kbd "gX"))
 | 
			
		||||
 | 
			
		||||
    :general (:states 'normal
 | 
			
		||||
                      "g x" '("exchange" . 'evil-exchange)
 | 
			
		||||
                      "g X" '("cancel exchange" . 'evil-exchange-cancel)
 | 
			
		||||
 | 
			
		||||
                      ;; What about a "normal mode" binding to regular emacs transpose?
 | 
			
		||||
                      "z w" '("transpose words" . transpose-words)
 | 
			
		||||
                      "z x" '("transpose sexps" . transpose-sexps)
 | 
			
		||||
                      "z k" '("transpose lines" . transpose-lines))
 | 
			
		||||
    :config
 | 
			
		||||
    (define-key evil-normal-state-map (kbd "g x") '("exchange" . evil-exchange))
 | 
			
		||||
    (define-key evil-normal-state-map (kbd "g X") '("cancel exchange" . evil-exchange-cancel))
 | 
			
		||||
    (define-key evil-normal-state-map (kbd "z w") '("transpose words" . transpose-words))
 | 
			
		||||
    (define-key evil-normal-state-map (kbd "z x") '("transpose sexps" . transpose-sexps))
 | 
			
		||||
    (define-key evil-normal-state-map (kbd "z k") '("transpose lines" . transpose-lines))
 | 
			
		||||
 | 
			
		||||
    :config (evil-exchange-install))
 | 
			
		||||
#+end_src
 | 
			
		||||
| 
						 | 
				
			
			@ -384,28 +382,29 @@ The [[https://github.com/edkolev/evil-lion][evil-lion]] package is a wrapper aro
 | 
			
		|||
#+begin_src emacs-lisp
 | 
			
		||||
  (use-package evil-lion
 | 
			
		||||
    :after evil
 | 
			
		||||
    :general
 | 
			
		||||
    (:states '(normal visual)
 | 
			
		||||
             "g a" '("lion ←" . evil-lion-left)
 | 
			
		||||
             "g A" '("lion →" . evil-lion-right)))
 | 
			
		||||
    :config
 | 
			
		||||
    (define-key evil-normal-state-map (kbd "g a") '("lion ←" . evil-lion-left))
 | 
			
		||||
    (define-key evil-normal-state-map (kbd "g A") '("lion →" . evil-lion-right)))
 | 
			
		||||
#+end_src
 | 
			
		||||
 | 
			
		||||
Lion sounds like /align/ … get it?
 | 
			
		||||
 | 
			
		||||
Where I like to align, is on variable assignments, e.g.
 | 
			
		||||
#+begin_src emacs-lisp :tangle no
 | 
			
		||||
  (let ((foobar        "Something something")
 | 
			
		||||
        (a             42)
 | 
			
		||||
        (very-long-var "odd string"))
 | 
			
		||||
    ;;
 | 
			
		||||
Where I like to align, is on variable assignments, for instance, converting the code on the left with the code on the right:
 | 
			
		||||
#+begin_example
 | 
			
		||||
  (let ((foobar "Something")            (let ((foobar        "Something")
 | 
			
		||||
      ⫾ (a 42)                         ⇒      (a             42)
 | 
			
		||||
        (very-long-var "odd string"))         (very-long-var "odd string")
 | 
			
		||||
    ;; ...
 | 
			
		||||
    )
 | 
			
		||||
#+end_src
 | 
			
		||||
#+end_example
 | 
			
		||||
 | 
			
		||||
When the point is /inside/ the variable assignment section, but not inside any particular assignment (see the ⫾ character), typing ~g a i x~ triggers =align= /inside an s-expression/. If you press ~RETURN~ for the /character/ to align, =evil-lion= package calls the built-in [[help:align][align]] function. This function chooses a regular expression based on a list of /rules/, and aligning Lisp variables requires a complicated regular expression. Extend [[elisp:(describe-variable 'align-rules-list)][align-rules-list]]:
 | 
			
		||||
 | 
			
		||||
If you press ~RETURN~ for the /character/ to align, =evil-lion= package simply calls the built-in [[help:align][align]] function. This function chooses a regular expression based on a list of /rules/, and aligning Lisp variables requires a complicated regular expression. Extend [[elisp:(describe-variable 'align-rules-list)][align-rules-list]]:
 | 
			
		||||
#+begin_src emacs-lisp
 | 
			
		||||
  (use-package align
 | 
			
		||||
    :config
 | 
			
		||||
    (add-to-list 'align-rules-list
 | 
			
		||||
                 `("lisp-assignments"
 | 
			
		||||
                 `(lisp-assignments
 | 
			
		||||
                   (regexp . ,(rx (group (one-or-more space))
 | 
			
		||||
                                  (or
 | 
			
		||||
                                   (seq "\"" (zero-or-more any) "\"")
 | 
			
		||||
| 
						 | 
				
			
			@ -419,13 +418,10 @@ The [[https://github.com/linktohack/evil-commentary][evil-commentary]] is a VI-l
 | 
			
		|||
 | 
			
		||||
#+begin_src emacs-lisp
 | 
			
		||||
  (use-package evil-commentary
 | 
			
		||||
    :config (evil-commentary-mode)
 | 
			
		||||
 | 
			
		||||
    :general
 | 
			
		||||
    (:states '(normal visual motion operator)
 | 
			
		||||
             "g c" '("comments" . evil-commentary)
 | 
			
		||||
             "g y" '("yank comment" . evil-commentary-yank)))
 | 
			
		||||
    :after evil
 | 
			
		||||
    :config (evil-commentary-mode))
 | 
			
		||||
#+end_src
 | 
			
		||||
 | 
			
		||||
** Evil Collection
 | 
			
		||||
Dropping into Emacs state is better than pure Evil state for applications, however, [[https://github.com/emacs-evil/evil-collection][the evil-collection package]] creates a hybrid between the two, that I like.
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -56,6 +56,7 @@ Can’t remember all the shortcuts on the ~g~ key, and =which-key= displays the
 | 
			
		|||
 | 
			
		||||
#+begin_src emacs-lisp :tangle no
 | 
			
		||||
  (use-package evil
 | 
			
		||||
    :after general
 | 
			
		||||
    :general
 | 
			
		||||
    (:states '(normal visual motion operator)
 | 
			
		||||
             ;; These go into operator mode, so the key sequence, g U i o
 | 
			
		||||
| 
						 | 
				
			
			@ -118,6 +119,7 @@ Can’t remember all the shortcuts on the ~g~ key, and =which-key= displays the
 | 
			
		|||
While we are at it, let’s readd, and relabel the ~z~ command functions:
 | 
			
		||||
#+begin_src emacs-lisp :tangle no
 | 
			
		||||
  (use-package evil
 | 
			
		||||
    :after general
 | 
			
		||||
    :general
 | 
			
		||||
    (:states '(normal visual motion operator)
 | 
			
		||||
             "z q" '("fill para" . fill-paragraph)
 | 
			
		||||
| 
						 | 
				
			
			@ -881,6 +883,7 @@ Remember these keys in the *Help* buffer:
 | 
			
		|||
Let's make Info behave a little more VI-like:
 | 
			
		||||
#+begin_src emacs-lisp
 | 
			
		||||
  (use-package info
 | 
			
		||||
    :after general
 | 
			
		||||
    :general
 | 
			
		||||
    (:states 'normal :keymaps 'Info-mode-map
 | 
			
		||||
             "B" 'Info-bookmark-jump
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -110,7 +110,7 @@ The variable, =org-hide-emphasis-markers=, is key to pretending that Emacs can b
 | 
			
		|||
 | 
			
		||||
#+begin_src emacs-lisp
 | 
			
		||||
  (use-package org-appear
 | 
			
		||||
    :ensure (:type git :host github :repo "awth13/org-appear")
 | 
			
		||||
    :ensure (:host github :repo "awth13/org-appear")
 | 
			
		||||
    :init (setq org-appear-trigger 'manual)
 | 
			
		||||
    :hook
 | 
			
		||||
    ((org-mode . (lambda ()
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -3,7 +3,7 @@
 | 
			
		|||
#+date:   2020-09-18
 | 
			
		||||
#+tags: emacs org
 | 
			
		||||
#+startup: inlineimages
 | 
			
		||||
#+lastmod: [2025-09-09 Tue]
 | 
			
		||||
#+lastmod: [2025-09-10 Wed]
 | 
			
		||||
 | 
			
		||||
A literate programming file for configuring org-mode and those files.
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -32,6 +32,7 @@ Org is a /large/ complex beast with a gazillion settings, so I discuss these lat
 | 
			
		|||
#+begin_src emacs-lisp :noweb yes
 | 
			
		||||
  (use-package org
 | 
			
		||||
    :ensure t
 | 
			
		||||
    :after general
 | 
			
		||||
    ;; TODO: Using the latest org-mode
 | 
			
		||||
    ;; ;; :straight (:type built-in)
 | 
			
		||||
    :mode (("\\.org" . org-mode))
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in a new issue