refactor: rename orig-fn arg in advice to fn
A minor tweak to our naming conventions for the first argument of an :around advice.
This commit is contained in:
parent
12732be155
commit
06392a723f
51 changed files with 223 additions and 229 deletions
|
@ -118,26 +118,26 @@ more information on modifiers."
|
|||
(back-to-indentation)))))))
|
||||
|
||||
;;;###autoload
|
||||
(defun +evil--insert-newline-below-and-respect-comments-a (orig-fn count)
|
||||
(defun +evil--insert-newline-below-and-respect-comments-a (fn count)
|
||||
(if (or (not +evil-want-o/O-to-continue-comments)
|
||||
(not (eq this-command 'evil-open-below))
|
||||
(evil-insert-state-p)
|
||||
(evil-emacs-state-p))
|
||||
(funcall orig-fn count)
|
||||
(funcall fn count)
|
||||
(letf! (defun evil-insert-newline-below () (+evil--insert-newline))
|
||||
(let ((evil-auto-indent evil-auto-indent))
|
||||
(funcall orig-fn count)))))
|
||||
(funcall fn count)))))
|
||||
|
||||
;;;###autoload
|
||||
(defun +evil--insert-newline-above-and-respect-comments-a (orig-fn count)
|
||||
(defun +evil--insert-newline-above-and-respect-comments-a (fn count)
|
||||
(if (or (not +evil-want-o/O-to-continue-comments)
|
||||
(not (eq this-command 'evil-open-above))
|
||||
(evil-insert-state-p)
|
||||
(evil-emacs-state-p))
|
||||
(funcall orig-fn count)
|
||||
(funcall fn count)
|
||||
(letf! (defun evil-insert-newline-above () (+evil--insert-newline 'above))
|
||||
(let ((evil-auto-indent evil-auto-indent))
|
||||
(funcall orig-fn count)))))
|
||||
(funcall fn count)))))
|
||||
|
||||
;;;###autoload (autoload '+evil-window-split-a "editor/evil/autoload/advice" nil t)
|
||||
(evil-define-command +evil-window-split-a (&optional count file)
|
||||
|
@ -179,7 +179,7 @@ more information on modifiers."
|
|||
(if file (evil-edit file)))
|
||||
|
||||
;;;###autoload (autoload '+evil-join-a "editor/evil/autoload/advice" nil nil)
|
||||
(defun +evil-join-a (orig-fn beg end)
|
||||
(defun +evil-join-a (fn beg end)
|
||||
"Join the selected lines.
|
||||
|
||||
This advice improves on `evil-join' by removing comment delimiters when joining
|
||||
|
@ -189,7 +189,7 @@ From https://github.com/emacs-evil/evil/issues/606"
|
|||
;; But revert to the default we're not in a comment, where
|
||||
;; `fill-region-as-paragraph' is too greedy.
|
||||
(if (not (doom-point-in-comment-p (min (max beg (1+ (point))) end)))
|
||||
(funcall orig-fn beg end)
|
||||
(funcall fn beg end)
|
||||
(let* ((count (count-lines beg end))
|
||||
(count (if (> count 1) (1- count) count))
|
||||
(fixup-mark (make-marker)))
|
||||
|
|
|
@ -134,9 +134,9 @@ directives. By default, this only recognizes C directives.")
|
|||
|
||||
;; HACK '=' moves the cursor to the beginning of selection. Disable this,
|
||||
;; since it's more disruptive than helpful.
|
||||
(defadvice! +evil--dont-move-cursor-a (orig-fn &rest args)
|
||||
(defadvice! +evil--dont-move-cursor-a (fn &rest args)
|
||||
:around #'evil-indent
|
||||
(save-excursion (apply orig-fn args)))
|
||||
(save-excursion (apply fn args)))
|
||||
|
||||
;; REVIEW In evil, registers 2-9 are buffer-local. In vim, they're global,
|
||||
;; so... Perhaps this should be PRed upstream?
|
||||
|
@ -166,11 +166,11 @@ directives. By default, this only recognizes C directives.")
|
|||
|
||||
;; Prevent gw (`evil-fill') and gq (`evil-fill-and-move') from squeezing
|
||||
;; spaces. It doesn't in vim, so it shouldn't in evil.
|
||||
(defadvice! +evil--no-squeeze-on-fill-a (orig-fn &rest args)
|
||||
(defadvice! +evil--no-squeeze-on-fill-a (fn &rest args)
|
||||
:around '(evil-fill evil-fill-and-move)
|
||||
(letf! (defun fill-region (from to &optional justify nosqueeze to-eop)
|
||||
(funcall fill-region from to justify t to-eop))
|
||||
(apply orig-fn args)))
|
||||
(apply fn args)))
|
||||
|
||||
;; Make ESC (from normal mode) the universal escaper. See `doom-escape-hook'.
|
||||
(advice-add #'evil-force-normal-state :after #'+evil-escape-a)
|
||||
|
|
|
@ -251,10 +251,10 @@ and complains if a module is loaded too early (during startup)."
|
|||
(with-demoted-errors "evil-collection error: %s"
|
||||
(evil-collection-init (list module)))))
|
||||
|
||||
(defadvice! +evil-collection-disable-blacklist-a (orig-fn)
|
||||
(defadvice! +evil-collection-disable-blacklist-a (fn)
|
||||
:around #'evil-collection-vterm-toggle-send-escape ; allow binding to ESC
|
||||
(let (evil-collection-key-blacklist)
|
||||
(funcall-interactively orig-fn)))
|
||||
(funcall-interactively fn)))
|
||||
|
||||
;; These modes belong to packages that Emacs always loads at startup, causing
|
||||
;; evil-collection and it's co-packages to all load immediately. We avoid this
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue