def-advice!->defadvice! & conform to new advice conventions
This commit does two things: - Renames def-advice! to defadvice!, in the spirit of naming convenience macros after the function/macro they enhance or replace. - Correct the names of advice functions to indicate visibility and intent. A public advice function like doom-set-jump-a is meant to be used elsewhere. A private one like +dired--cleanup-header-line-a shouldn't -- it likely won't work anywhere but the function(s) it was made to advise.
This commit is contained in:
parent
8aa7772e4e
commit
82ae3a73f3
43 changed files with 126 additions and 121 deletions
|
@ -69,7 +69,7 @@
|
|||
(set-popup-rule! "^\\*\\(?:trepanjs:\\(?:g\\|zsh\\|bash\\)db\\|pdb \\)"
|
||||
:size 20 :select nil :quit nil)
|
||||
|
||||
(def-advice! +debugger-cleanup-after-realgud-a (&optional buf)
|
||||
(defadvice! +debugger--cleanup-after-realgud-a (&optional buf)
|
||||
"Kill command buffer when debugging session ends (which closes its popup)."
|
||||
:after #'realgud:terminate
|
||||
(when (stringp buf)
|
||||
|
@ -81,7 +81,7 @@
|
|||
;; Monkey-patch `realgud:run-process' to run in a popup.
|
||||
;; TODO Find a more elegant solution
|
||||
;; FIXME Causes realgud:cmd-* to focus popup on every invocation
|
||||
(def-advice! +debugger-realgud-run-process-a
|
||||
(defadvice! +debugger--realgud-open-in-other-window-a
|
||||
(debugger-name script-filename cmd-args minibuffer-history-var &optional no-reset)
|
||||
:override #'realgud:run-process
|
||||
(let* ((cmd-buf (apply #'realgud-exec-shell debugger-name script-filename
|
||||
|
|
|
@ -29,14 +29,14 @@ buffer/window/frame switch, which is less expensive."
|
|||
nil `((,(regexp-opt +direnv--keywords 'symbols)
|
||||
(0 font-lock-keyword-face))))))
|
||||
|
||||
(def-advice! +direnv--update-a (&rest _)
|
||||
(defadvice! +direnv--update-a (&rest _)
|
||||
"Update direnv. Useful to advise functions that may run
|
||||
environment-sensitive logic like `flycheck-default-executable-find'. This fixes
|
||||
flycheck issues with direnv and on nix."
|
||||
:before #'flycheck-default-executable-find
|
||||
(direnv--maybe-update-environment))
|
||||
|
||||
(def-advice! +direnv--fail-gracefully-a (orig-fn)
|
||||
(defadvice! +direnv--fail-gracefully-a (orig-fn)
|
||||
"Don't try to update direnv if the executable isn't present."
|
||||
:around #'direnv--maybe-update-environment
|
||||
(if (executable-find "direnv")
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
(use-package! editorconfig
|
||||
:after-call (doom-switch-buffer-hook after-find-file)
|
||||
:config
|
||||
(def-advice! +editorconfig-smart-detection-a (orig-fn)
|
||||
(defadvice! +editorconfig--smart-detection-a (orig-fn)
|
||||
"Retrieve the properties for the current file. If it doesn't have an
|
||||
extension, try to guess one."
|
||||
:around #'editorconfig-call-editorconfig-exec
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
|
||||
(set-popup-rule! "^\\*quickrun" :size 0.3 :ttl 0)
|
||||
|
||||
(def-advice! +eval-quickrun-auto-close-a (&rest _)
|
||||
(defadvice! +eval--quickrun-auto-close-a (&rest _)
|
||||
"Allows us to silently re-run quickrun from within the quickrun buffer."
|
||||
:before '(quickrun quickrun-region)
|
||||
(when-let (win (get-buffer-window quickrun--buffer-name))
|
||||
|
@ -22,7 +22,7 @@
|
|||
(message ""))
|
||||
(delete-window win)))
|
||||
|
||||
(def-advice! +eval-quickrun--outputter-replace-region-a ()
|
||||
(defadvice! +eval--quickrun-fix-evil-visual-region-a ()
|
||||
"Make `quickrun-replace-region' recognize evil visual selections."
|
||||
:override #'quickrun--outputter-replace-region
|
||||
(let ((output (buffer-substring-no-properties (point-min) (point-max))))
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
|
||||
(set-popup-rule! "^\\*gist-" :ignore t)
|
||||
|
||||
(def-advice! +gist-list-render-a (orig-fn &rest args)
|
||||
(defadvice! +gist--open-in-popup-a (orig-fn &rest args)
|
||||
:around #'gist-list-render
|
||||
(funcall orig-fn (car args) t)
|
||||
(unless (cadr args)
|
||||
|
|
|
@ -108,7 +108,7 @@ this list.")
|
|||
;; xref to be one too.
|
||||
(remove-hook 'xref-backend-functions #'etags--xref-backend)
|
||||
;; ...however, it breaks `projectile-find-tag', unless we put it back.
|
||||
(def-advice! +lookup-projectile-find-tag-a (orig-fn)
|
||||
(defadvice! +lookup--projectile-find-tag-a (orig-fn)
|
||||
:around #'projectile-find-tag
|
||||
(let ((xref-backend-functions '(etags--xref-backend t)))
|
||||
(funcall orig-fn)))
|
||||
|
@ -143,7 +143,7 @@ this list.")
|
|||
;; Before `gnutls' is loaded, `gnutls-algorithm-priority' is treated as a
|
||||
;; lexical variable, which breaks `+lookup*fix-gnutls-error'
|
||||
(defvar gnutls-algorithm-priority)
|
||||
(def-advice! +lookup-fix-gnutls-error-a (orig-fn url)
|
||||
(defadvice! +lookup--fix-gnutls-error-a (orig-fn url)
|
||||
"Fixes integer-or-marker-p errors emitted from Emacs' url library,
|
||||
particularly, the `url-retrieve-synchronously' call in
|
||||
`dash-docs-read-json-from-url'. This is part of a systemic issue with Emacs 26's
|
||||
|
|
|
@ -86,14 +86,14 @@ It is passed a user and repository name.")
|
|||
(set-popup-rule! "^\\*?[0-9]+:\\(?:new-\\|[0-9]+$\\)" :size 0.45 :modeline t :ttl 0 :quit nil)
|
||||
(set-popup-rule! "^\\*\\(?:[^/]+/[^ ]+ #[0-9]+\\*$\\|Issues\\|Pull-Requests\\|forge\\)" :ignore t)
|
||||
|
||||
(def-advice! +magit--forge-get-repository-lazily-a (&rest _)
|
||||
(defadvice! +magit--forge-get-repository-lazily-a (&rest _)
|
||||
"Make `forge-get-repository' return nil if the binary isn't built yet.
|
||||
This prevents emacsql getting compiled, which appears to come out of the blue
|
||||
and blocks Emacs for a short while."
|
||||
:before-while #'forge-get-repository
|
||||
(file-executable-p emacsql-sqlite-executable))
|
||||
|
||||
(def-advice! +magit--forge-build-binary-lazily-a (&rest _)
|
||||
(defadvice! +magit--forge-build-binary-lazily-a (&rest _)
|
||||
"Make `forge-dispatch' only build emacsql if necessary.
|
||||
Annoyingly, the binary gets built as soon as Forge is loaded. Since we've
|
||||
disabled that in `+magit--forge-get-repository-lazily-a', we must manually
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
(setq password-store-password-length 12)
|
||||
|
||||
;; Fix hard-coded password-store location; respect PASSWORD_STORE_DIR envvar
|
||||
(def-advice! +pass-read-entry-a (entry)
|
||||
(defadvice! +pass--respect-pass-dir-envvar-a (entry)
|
||||
"Return a string with the file content of ENTRY."
|
||||
:override #'auth-source-pass--read-entry
|
||||
(with-temp-buffer
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
(after! prodigy
|
||||
(set-evil-initial-state! 'prodigy-mode 'emacs)
|
||||
|
||||
(def-advice! +prodigy-services-a (orig-fn &rest args)
|
||||
(defadvice! +prodigy--add-project-property-a (orig-fn &rest args)
|
||||
"Adds a new :project property to prodigy services, which hides the service
|
||||
unless invoked from the relevant project."
|
||||
:around #'prodigy-services
|
||||
|
|
|
@ -55,7 +55,7 @@ open a file."
|
|||
;; this is necessary in case the user opens emacs with file arguments
|
||||
(advice-add 'after-find-file :before #'+wakatime-autostart-h))
|
||||
|
||||
(def-advice! +wakatime-append-options-a (ret)
|
||||
(defadvice! +wakatime--append-options-a (ret)
|
||||
"Modifies the wakatime command string so that `+wakatime-hide-filenames' and
|
||||
`+wakatime-home' are respected."
|
||||
:filter-return #'wakatime-client-command
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue