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:
Henrik Lissner 2019-07-23 17:24:56 +02:00
parent 8aa7772e4e
commit 82ae3a73f3
No known key found for this signature in database
GPG key ID: 5F6C0EA160557395
43 changed files with 126 additions and 121 deletions

View file

@ -92,7 +92,8 @@ playback.")
(add-hook 'circe-channel-mode-hook #'turn-on-visual-line-mode)
(def-advice! +irc-circe-disconnect-hook-a (&rest _)
(defadvice! +irc--circe-run-disconnect-hook-a (&rest _)
"Runs `+irc-disconnect-hook' after circe disconnects."
:after #'circe--irc-conn-disconnected
(run-hooks '+irc-disconnect-hook))

View file

@ -27,7 +27,7 @@
;; Allow users to switch between backends on the fly. E.g. C-x C-s followed
;; by C-x C-n, will switch from `company-yasnippet' to
;; `company-dabbrev-code'.
(def-advice! +company-abort-previous-a (&rest _)
(defadvice! +company--abort-previous-a (&rest _)
:before #'company-begin-backend
(company-abort)))

View file

@ -83,7 +83,7 @@ be negative.")
:init
(when (and EMACS26+ (featurep! +childframe))
(setq helm-display-function #'+helm-posframe-display-fn)
(def-advice! +helm--fix-get-font-height-a (orig-fn position)
(defadvice! +helm--fix-get-font-height-a (orig-fn position)
"Fix \"Specified window is not displaying the current buffer\" error."
:around #'posframe--get-font-height
(ignore-errors (funcall orig-fn position))))

View file

@ -28,7 +28,7 @@
(insert "~/")
(call-interactively #'self-insert-command))))
(def-advice! +ido-sort-mtime-a ()
(defadvice! +ido--sort-mtime-a ()
"Sort ido filelist by mtime instead of alphabetically."
:override #'ido-sort-mtime
(setq ido-temp-list

View file

@ -93,7 +93,7 @@ immediately runs it on the current candidate (ending the ivy session)."
(after! yasnippet
(add-to-list 'yas-prompt-functions #'+ivy-yas-prompt nil #'eq))
(def-advice! +ivy--inhibit-ivy-in-evil-ex-a (orig-fn &rest args)
(defadvice! +ivy--inhibit-in-evil-ex-a (orig-fn &rest args)
"`ivy-completion-in-region' struggles with completing certain
evil-ex-specific constructs, so we disable it solely in evil-ex."
:around #'evil-ex

View file

@ -12,7 +12,7 @@
(use-package! expand-region
:commands (er/contract-region er/mark-symbol er/mark-word)
:config
(def-advice! doom--quit-expand-region-a ()
(defadvice! doom--quit-expand-region-a ()
"Properly abort an expand-region region."
:before '(evil-escape doom/escape)
(when (memq last-command '(er/expand-region er/contract-region))

View file

@ -8,7 +8,7 @@
doom-leader-key doom-localleader-key
doom-leader-alt-key doom-localleader-alt-key))
(def-advice! +default-evil-collection-disable-blacklist-a (orig-fn)
(defadvice! +default-evil-collection-disable-blacklist-a (orig-fn)
:around #'evil-collection-vterm-toggle-send-escape ; allow binding to ESC
(let (evil-collection-key-blacklist)
(apply orig-fn)))

View file

@ -28,7 +28,7 @@
;; Nicer code-folding overlays (with fringe indicators)
hs-set-up-overlay #'+fold-hideshow-set-up-overlay-fn)
(def-advice! +fold-hideshow-ensure-mode-a (&rest _)
(defadvice! +fold--hideshow-ensure-mode-a (&rest _)
"Ensure `hs-minor-mode' is enabled."
:before '(hs-toggle-hiding hs-hide-block hs-hide-level hs-show-all hs-hide-all)
(unless (bound-and-true-p hs-minor-mode)

View file

@ -107,7 +107,7 @@
;; When running edit-lines, point will return (position + 1) as a result of
;; how evil deals with regions
(def-advice! +multiple-cursors-adjust-mark-for-evil-a (&rest _)
(defadvice! +multiple--cursors-adjust-mark-for-evil-a (&rest _)
:before #'mc/edit-lines
(when (and (bound-and-true-p evil-mode)
(not (memq evil-state '(insert emacs))))

View file

@ -10,14 +10,14 @@
(defvar +objed--extra-face-remaps nil)
(def-advice! +objed-add-face-remaps-a (&rest _)
(defadvice! +objed--add-face-remaps-a (&rest _)
"Add extra face remaps when objed activates."
:after 'objed--init
(when (memq 'objed-hl (assq 'hl-line face-remapping-alist))
(push (face-remap-add-relative 'solaire-hl-line-face 'objed-hl)
+objed--extra-face-remaps)))
(def-advice! +objed-remove-face-remaps-a (&rest _)
(defadvice! +objed--remove-face-remaps-a (&rest _)
"Remove extra face remaps when objed de-activates."
:after 'objed--reset
(unless (memq 'objed-hl (assq 'hl-line face-remapping-alist))

View file

@ -75,7 +75,7 @@
:defer t
:init (setq aya-persist-snippets-dir (concat doom-etc-dir "auto-snippets/"))
:config
(def-advice! +snippets-inhibit-yas-global-mode (orig-fn &rest args)
(defadvice! +snippets--inhibit-yas-global-mode (orig-fn &rest args)
"auto-yasnippet enables `yas-global-mode'. This is obnoxious for folks like
us who use yas-minor-mode and enable yasnippet more selectively. This advice
swaps `yas-global-mode' with `yas-minor-mode'."

View file

@ -56,7 +56,7 @@
;; confusing than helpful.
(advice-add #'dired-k--highlight-by-file-attribyte :override #'ignore)
(def-advice! +dired-interrupt-process-a (orig-fn &rest args)
(defadvice! +dired--interrupt-process-a (orig-fn &rest args)
"Fixes dired-k killing git processes too abruptly, leaving behind disruptive
.git/index.lock files."
:around #'dired-k--start-git-status
@ -64,7 +64,7 @@
(symbol-function #'interrupt-process)))
(apply orig-fn args)))
(def-advice! +dired-dired-k-highlight-a (orig-fn &rest args)
(defadvice! +dired--dired-k-highlight-a (orig-fn &rest args)
"Butt out if the requested directory is remote (i.e. through tramp)."
:around #'dired-k--highlight
(unless (file-remote-p default-directory)
@ -84,7 +84,7 @@
(set-popup-rule! "^\\*ranger" :ignore t)
(def-advice! +dired-cleanup-header-line-a ()
(defadvice! +dired--cleanup-header-line-a ()
"Ranger fails to clean up `header-line-format' when it is closed, so..."
:before #'ranger-revert
(dolist (buffer (buffer-list))
@ -93,7 +93,7 @@
(when (equal header-line-format '(:eval (ranger-header-line)))
(setq header-line-format nil))))))
(def-advice! +dired-cleanup-mouse1-bind-a ()
(defadvice! +dired--cleanup-mouse1-bind-a ()
"Ranger binds an anonymous function to mouse-1 after previewing a buffer
that prevents the user from escaping the window with the mouse. This command is
never cleaned up if the buffer already existed before ranger was initialized, so

View file

@ -10,7 +10,7 @@
(after! git-timemachine
;; HACK Waiting for https://gitlab.com/pidu/git-timemachine/issues/77
(def-advice! +vc-git-timemachine-show-commit-a ()
(defadvice! +vc--git-timemachine-show-commit-a ()
"Fix `git-timemachine-show-commit'."
:override #'git-timemachine-show-commit
(interactive)

View file

@ -88,9 +88,8 @@
(let ((maildir (mu4e-message-field msg :maildir)))
(format "%s" (substring maildir 1 (string-match-p "/" maildir 1)))))))
;; Refresh the current view after marks are executed
(def-advice! +mu4e-refresh-a (&rest _) :after #'mu4e-mark-execute-all
(mu4e-headers-rerun-search))
(defadvice! +mu4e--refresh-current-view-a (&rest _)
:after #'mu4e-mark-execute-all (mu4e-headers-rerun-search))
(when (featurep! :tools flyspell)
(add-hook 'mu4e-compose-mode-hook #'flyspell-mode))

View file

@ -31,7 +31,7 @@
;;
;;; Hacks
(def-advice! +chinese-org-html-paragraph-a (paragraph contents info)
(defadvice! +chinese--org-html-paragraph-a (paragraph contents info)
"Join consecutive Chinese lines into a single long line without unwanted space
when exporting org-mode to html."
:filter-args #'org-html-paragraph

View file

@ -41,7 +41,7 @@
;;
;;; Hacks
(def-advice! +japanese-org-html-paragraph-a (paragraph contents info)
(defadvice! +japanese--org-html-paragraph-a (paragraph contents info)
"Join consecutive Japanese lines into a single long line without unwanted space
when exporting org-mode to html."
:filter-args #'org-html-paragraph

View file

@ -114,7 +114,7 @@ This marks a foldable marker for `outline-minor-mode' in elisp buffers.")
(advice-add 'describe-function-1 :after #'elisp-demos-advice-describe-function-1)
(advice-add 'helpful-update :after #'elisp-demos-advice-helpful-update)
:config
(def-advice! +emacs-lisp-elisp-demos--search-a (orig-fn symbol)
(defadvice! +emacs-lisp--add-doom-elisp-demos-a (orig-fn symbol)
"Add Doom's own demos to help buffers."
:around #'elisp-demos--search
(or (funcall orig-fn symbol)

View file

@ -19,15 +19,16 @@
(set-company-backend! 'dante-mode #'dante-company)
(defun +haskell*restore-modified-state (orig-fn &rest args)
"Dante quietly saves the current buffer (without triggering save hooks) before
(defadvice! +haskell--restore-modified-state-a (orig-fn &rest args)
"Marks the buffer as falsely modified.
Dante quietly saves the current buffer (without triggering save hooks) before
invoking flycheck, unexpectedly leaving the buffer in an unmodified state. This
is annoying if we depend on save hooks to do work on the buffer (like
reformatting), so we restore a (false) modified state."
reformatting)."
:around #'dante-async-load-current-buffer
(let ((modified-p (buffer-modified-p)))
(apply orig-fn args)
(if modified-p (set-buffer-modified-p t))))
(advice-add #'dante-async-load-current-buffer :around #'+haskell*restore-modified-state)
(when (featurep 'evil)
(add-hook 'dante-mode-hook #'evil-normalize-keymaps))

View file

@ -12,7 +12,7 @@ nimsuggest isn't installed."
(when IS-WINDOWS
;; TODO File PR/report upstream (https://github.com/nim-lang/nim-mode)
(def-advice! +nim--suggest-get-dirty-dir-a ()
(defadvice! +nim--suggest-get-dirty-dir-a ()
"The original `nimsuggest--get-dirty-dir' incorrectly extracts the frame
number from the string representation of `selected-frame', which can contain
characters that are illegal on Windows, causing invalid argument errors when
@ -24,7 +24,7 @@ characters that are illegal on Windows, causing invalid argument errors when
(file-name-as-directory (concat nimsuggest-dirty-directory frame-num-str))))
;; TODO File PR/report upstream (https://github.com/nim-lang/nim-mode)
(def-advice! +nim--suggest-get-temp-file-name-a (path)
(defadvice! +nim--suggest-get-temp-file-name-a (path)
"Removes invalid characters from the temp file path, including the unicode
character that colon is replaced with, which is known to cause issues on
windows."

View file

@ -137,14 +137,14 @@ when executed.")
take one argument (the language specified in the src block, as a string). Stops
at the first function to return non-nil.")
(def-advice! +org--src-lazy-load-library-a (lang)
(defadvice! +org--src-lazy-load-library-a (lang)
"Lazy load a babel package to ensure syntax highlighting."
:before #'org-src--get-lang-mode
(or (cdr (assoc lang org-src-lang-modes))
(fboundp (intern-soft (format "%s-mode" lang)))
(require (intern-soft (format "ob-%s" lang)) nil t)))
(def-advice! +org--babel-lazy-load-library-a (info)
(defadvice! +org--babel-lazy-load-library-a (info)
"Load babel libraries lazily when babel blocks are executed."
:after-while #'org-babel-confirm-evaluate
(let* ((lang (nth 0 info))
@ -218,7 +218,7 @@ Is relative to `org-directory', unless it is absolute. Is used in Doom's default
(file+headline +org-capture-project-notes-file "Unreleased")
"* TODO %?\n%i\n%a" :prepend t :kill-buffer t)))
(def-advice! +org-capture-expand-variable-file-a (file)
(defadvice! +org--capture-expand-variable-file-a (file)
"If a variable is used for a file path in `org-capture-template', it is used
as is, and expanded relative to `default-directory'. This changes it to be
relative to `org-directory', unless it is an absolute path."
@ -227,7 +227,7 @@ relative to `org-directory', unless it is an absolute path."
(expand-file-name (symbol-value file) org-directory)
file))
(def-advice! +org--prevent-save-prompts-when-refiling-a (&rest _)
(defadvice! +org--prevent-save-prompts-when-refiling-a (&rest _)
"Fix #462: when refiling from org-capture, Emacs prompts to kill the
underlying, modified buffer. This fixes that."
:after 'org-refile
@ -314,7 +314,7 @@ path too.")
;; place, and I want to be able to refer back to old exports if needed.
(setq +org-export-directory (expand-file-name +org-export-directory org-directory))
(def-advice! +org--export-output-file-name-a (args)
(defadvice! +org--export-output-file-name-a (args)
"Return a centralized export location unless one is provided or the current
file isn't in `org-directory'."
:filter-args #'org-export-output-file-name
@ -445,7 +445,7 @@ file isn't in `org-directory'."
conditions where a window's buffer hasn't changed at the time this hook is run."
(run-at-time 0.1 nil #'recenter)))
(def-advice! +org--strip-properties-from-outline-a (orig-fn path &optional width prefix separator)
(defadvice! +org--strip-properties-from-outline-a (orig-fn path &optional width prefix separator)
"Remove link syntax and fix variable height text (e.g. org headings) in the
eldoc string."
:around #'org-format-outline-path
@ -471,7 +471,7 @@ the current workspace."
(get-current-persp)
nil)))))
(def-advice! +org--exclude-agenda-buffers-from-recentf-a (orig-fn file)
(defadvice! +org--exclude-agenda-buffers-from-recentf-a (orig-fn file)
"Prevent temporarily opened agenda buffers from polluting recentf."
:around #'org-get-agenda-file-buffer
(let ((recentf-exclude (list (lambda (_file) t))))
@ -719,7 +719,7 @@ between the two."
browsers) can invoke specialized behavior from Emacs. Normally you'd simply
require `org-protocol' and use it, but the package loads all of org for no
compelling reason, so..."
(def-advice! +org--server-visit-files-a (args)
(defadvice! +org--server-visit-files-a (args)
"Advise `server-visit-flist' to invoke `org-protocol' lazily."
:filter-args #'server-visit-files
(cl-destructuring-bind (files proc &optional nowait) args
@ -853,7 +853,7 @@ compelling reason, so..."
;;; Packages
(after! toc-org
(setq toc-org-hrefify-default "gh")
(def-advice! +org-unfold-toc-a (&rest _)
(defadvice! +org--unfold-toc-a (&rest _)
:before #'toc-org-insert-toc
(save-excursion
(when (re-search-forward toc-org-toc-org-regexp (point-max) t)
@ -882,7 +882,8 @@ compelling reason, so..."
:commands org-clock-save
:init
(setq org-clock-persist t)
(def-advice! +org-clock-load-a (&rest _)
(defadvice! +org--clock-load-a (&rest _)
"Lazy load org-clock until its commands are used."
:before '(org-clock-in
org-clock-out
org-clock-in-last

View file

@ -22,7 +22,7 @@
;; Handle non-image files a little differently. Images should be inserted
;; as-is, as image previews. Other files, like pdfs or zips, should be linked
;; to, with an icon indicating the type of file.
(def-advice! +org-dragndrop-insert-link-a (_link filename)
(defadvice! +org--dragndrop-insert-link-a (_link filename)
"Produces and inserts a link to FILENAME into the document.
If FILENAME is an image, produce an attach:%s path, otherwise use file:%s (with
@ -50,7 +50,7 @@ an file icon produced by `+org-attach--icon')."
(file-name-nondirectory (directory-file-name filename)))))))
(advice-add #'org-download--dir-2 :override #'ignore)
(def-advice! +org-dragndrop-download-fullname-a (path)
(defadvice! +org--dragndrop-download-fullname-a (path)
"Write PATH relative to current file."
:filter-return #'org-download--fullname
(let ((dir (or (if buffer-file-name (file-name-directory buffer-file-name))

View file

@ -54,7 +54,7 @@
;; `rustic-setup-rls' uses `package-installed-p' unnecessarily, which breaks
;; because Doom lazy loads package.el.
(def-advice! +rust--disable-package-call-a (orig-fn &rest args)
(defadvice! +rust--disable-package-call-a (orig-fn &rest args)
:around #'rustic-setup-rls
(cl-letf (((symbol-function 'package-installed-p)
(symbol-function 'ignore)))

View file

@ -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

View file

@ -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")

View file

@ -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

View file

@ -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))))

View file

@ -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)

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -82,7 +82,7 @@
(defun +doom-disable-fringes-in-minibuffer-h (&rest _)
(set-window-fringes (minibuffer-window) 0 0 nil)))
(def-advice! +doom--no-fringes-in-which-key-buffer-a (&rest _)
(defadvice! +doom--no-fringes-in-which-key-buffer-a (&rest _)
:after 'which-key--show-buffer-side-window
(+doom-disable-fringes-in-minibuffer-h)
(set-window-fringes (get-buffer-window which-key--buffer) 0 0 nil))

View file

@ -59,7 +59,7 @@
;; Some functions modify the buffer, causing the modeline to show a false
;; modified state, so force them to behave.
(def-advice! +modeline--inhibit-modification-hooks-a (orig-fn &rest args)
(defadvice! +modeline--inhibit-modification-hooks-a (orig-fn &rest args)
:around #'ws-butler-after-save
(with-silent-modifications (apply orig-fn args))))

View file

@ -49,7 +49,7 @@
(defun +neotree-fix-cursor-h (&rest _)
(with-current-buffer neo-global--buffer
(+neotree*indent-cursor))))
(def-advice! +neotree-indent-cursor-a (&rest _)
(defadvice! +neotree--indent-cursor-a (&rest _)
:after '(neotree-next-line neotree-previous-line)
(beginning-of-line)
(skip-chars-forward " \t\r")))

View file

@ -38,7 +38,7 @@
;;;###package company
(def-advice! +popup--dont-select-me-a (orig-fn &rest args)
(defadvice! +popup--dont-select-me-a (orig-fn &rest args)
:around #'company-show-doc-buffer
(let ((+popup--inhibit-select t))
(apply orig-fn args)))
@ -50,7 +50,7 @@
;; When eshell runs a visual command (see `eshell-visual-commands'), it spawns
;; a term buffer to run it in, but where it spawns it is the problem...
(def-advice! +popup--eshell-undedicate-popup (&rest _)
(defadvice! +popup--eshell-undedicate-popup (&rest _)
"Force spawned term buffer to share with the eshell popup (if necessary)."
:before #'eshell-exec-visual
(when (+popup-window-p)
@ -62,7 +62,7 @@
;;;###package evil
(progn
;; Make evil-mode cooperate with popups
(def-advice! +popup--evil-command-window-a (hist cmd-key execute-fn)
(defadvice! +popup--evil-command-window-a (hist cmd-key execute-fn)
"Monkey patch the evil command window to use `pop-to-buffer' instead of
`switch-to-buffer', allowing the popup manager to handle it."
:override #'evil-command-window
@ -81,7 +81,7 @@
(evil-command-window-mode)
(evil-command-window-insert-commands hist)))
(def-advice! +popup--evil-command-window-execute-a ()
(defadvice! +popup--evil-command-window-execute-a ()
"Execute the command under the cursor in the appropriate buffer, rather than
the command buffer."
:override #'evil-command-window-execute
@ -150,7 +150,7 @@ the command buffer."
;;;###package helpful
(def-advice! +popup--helpful-open-in-origin-window-a (button)
(defadvice! +popup--helpful-open-in-origin-window-a (button)
"Open links in non-popup, originating window rather than helpful's window."
:override #'helpful--navigate
(let ((path (substring-no-properties (button-get button 'path)))
@ -172,7 +172,7 @@ the command buffer."
(setq helm-default-display-buffer-functions '(+popup-display-buffer-stacked-side-window-fn))
;; Fix #897: "cannot open side window" error when TAB-completing file links
(def-advice! +popup--helm-hide-org-links-popup-a (orig-fn &rest args)
(defadvice! +popup--helm-hide-org-links-popup-a (orig-fn &rest args)
:around #'org-insert-link
(cl-letf* ((old-org-completing-read (symbol-function 'org-completing-read))
((symbol-function 'org-completing-read)
@ -191,7 +191,7 @@ the command buffer."
(apply orig-fn args)))
;; Fix left-over popup window when closing persistent help for `helm-M-x'
(def-advice! +popup--helm-elisp--persistent-help-a (candidate _fun &optional _name)
(defadvice! +popup--helm-elisp--persistent-help-a (candidate _fun &optional _name)
:before #'helm-elisp--persistent-help
(let (win)
(when (and (helm-attr 'help-running-p)
@ -200,7 +200,7 @@ the command buffer."
(delete-window win))))
;; `helm-ag'
(def-advice! +popup--helm-pop-to-buffer-a (orig-fn &rest args)
(defadvice! +popup--helm-pop-to-buffer-a (orig-fn &rest args)
:around #'helm-ag--edit
(pop-to-buffer
(save-window-excursion (apply orig-fn args)
@ -212,7 +212,7 @@ the command buffer."
;;;###package Info
(def-advice! +popup--switch-to-info-window-a (&rest _)
(defadvice! +popup--switch-to-info-window-a (&rest _)
:after #'info-lookup-symbol
(when-let (win (get-buffer-window "*info*"))
(when (+popup-window-p win)
@ -234,7 +234,7 @@ the command buffer."
;; Org has a scorched-earth window management policy I'm not fond of. i.e. it
;; kills all other windows just so it can monopolize the frame. No thanks. We
;; can do better ourselves.
(def-advice! +popup-suppress-delete-other-windows-a (orig-fn &rest args)
(defadvice! +popup--suppress-delete-other-windows-a (orig-fn &rest args)
:around '(org-add-log-note
org-capture-place-template
org-export--dispatch-ui
@ -246,7 +246,7 @@ the command buffer."
(apply orig-fn args))
(apply orig-fn args)))
(def-advice! +popup--org-fix-tags-window-a (orig-fn &rest args)
(defadvice! +popup--org-fix-tags-window-a (orig-fn &rest args)
"Hides the mode-line in *Org tags* buffer so you can actually see its
content and displays it in a side window without deleting all other windows.
Ugh, such an ugly hack."
@ -265,7 +265,7 @@ Ugh, such an ugly hack."
(apply orig-fn args))
(apply orig-fn args)))
(def-advice! +popup-org-src-pop-to-buffer-a (orig-fn buffer context)
(defadvice! +popup--org-src-pop-to-buffer-a (orig-fn buffer context)
"Hand off the src-block window to the popup system by using `display-buffer'
instead of switch-to-buffer-*."
:around #'org-src-switch-to-buffer
@ -276,7 +276,7 @@ instead of switch-to-buffer-*."
(setq org-src-window-setup 'popup-window)
;; Ensure todo, agenda, and other minor popups are delegated to the popup system.
(def-advice! +popup-org-pop-to-buffer-a (orig-fn buf &optional norecord)
(defadvice! +popup--org-pop-to-buffer-a (orig-fn buf &optional norecord)
"Use `pop-to-buffer' instead of `switch-to-buffer' to open buffer.'"
:around #'org-switch-to-buffer-other-window
(if +popup-mode
@ -287,7 +287,7 @@ instead of switch-to-buffer-*."
(setq org-agenda-window-setup 'popup-window
org-agenda-restore-windows-after-quit nil)
;; Don't monopolize the frame!
(def-advice! +popup-org-agenda-suppress-delete-other-windows-a (orig-fn &rest args)
(defadvice! +popup--org-agenda-suppress-delete-other-windows-a (orig-fn &rest args)
:around #'org-agenda-prepare-window
(cond ((not +popup-mode)
(apply orig-fn args))
@ -307,7 +307,7 @@ instead of switch-to-buffer-*."
;;;###package persp-mode
(def-advice! +popup--persp-mode-restore-popups-a (&rest _)
(defadvice! +popup--persp-mode-restore-popups-a (&rest _)
"Restore popup windows when loading a perspective from file."
:after #'persp-load-state-from-file
(dolist (window (window-list))
@ -334,7 +334,7 @@ instead of switch-to-buffer-*."
;;;###package profiler
(def-advice! +popup--profiler-report-find-entry-in-other-window-a (orig-fn function)
(defadvice! +popup--profiler-report-find-entry-in-other-window-a (orig-fn function)
:around #'profiler-report-find-entry
(cl-letf (((symbol-function 'find-function)
(symbol-function 'find-function-other-window)))
@ -365,7 +365,7 @@ instead of switch-to-buffer-*."
;;;###package windmove
;; Users should be able to hop into popups easily, but Elisp shouldn't.
(def-advice! doom--ignore-window-parameters-a (orig-fn &rest args)
(defadvice! +popup--ignore-window-parameters-a (orig-fn &rest args)
"Allow *interactive* window moving commands to traverse popups."
:around '(windmove-up windmove-down windmove-left windmove-right)
(cl-letf (((symbol-function #'windmove-find-other-window)

View file

@ -600,8 +600,8 @@ Accepts the same arguments as `display-buffer-in-side-window'. You must set
;; Emacs backwards compatibility
(unless EMACS27+
(def-advice! +popup-set-window-dedicated-a (window)
"Ensure `window--dispaly-buffer' respects `display-buffer-mark-dedicated'.
(defadvice! +popup--set-window-dedicated-a (window)
"Ensure `window--display-buffer' respects `display-buffer-mark-dedicated'.
This was not so until recent Emacs 27 builds, where it causes breaking errors.
This advice ensures backwards compatibility for Emacs <= 26 users."

View file

@ -118,7 +118,7 @@ stored in `persp-save-dir'.")
(add-to-list 'persp-add-buffer-on-after-change-major-mode-filter-functions
#'doom-unreal-buffer-p)
(def-advice! +workspaces-evil-alternate-buffer-a (&optional window)
(defadvice! +workspaces--evil-alternate-buffer-a (&optional window)
"Make `evil-alternate-buffer' ignore buffers outside the current workspace."
:override #'evil-alternate-buffer
(let* ((prev-buffers