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
|
@ -30,7 +30,7 @@
|
|||
(add-to-list 'editorconfig-exclude-regexps
|
||||
"\\.\\(zip\\|\\(doc\\|xls\\|ppt\\)x\\)\\'")
|
||||
|
||||
(defadvice! +editorconfig--smart-detection-a (orig-fn)
|
||||
(defadvice! +editorconfig--smart-detection-a (fn)
|
||||
"Retrieve the properties for the current file. If it doesn't have an
|
||||
extension, try to guess one."
|
||||
:around #'editorconfig-call-editorconfig-exec
|
||||
|
@ -42,7 +42,7 @@ extension, try to guess one."
|
|||
(if-let (ext (alist-get major-mode +editorconfig-mode-alist))
|
||||
(concat "." ext)
|
||||
"")))))
|
||||
(funcall orig-fn)))
|
||||
(funcall fn)))
|
||||
|
||||
(add-hook! 'editorconfig-after-apply-functions
|
||||
(defun +editorconfig-disable-indent-detection-h (props)
|
||||
|
|
|
@ -9,9 +9,9 @@
|
|||
|
||||
(set-popup-rule! "^\\*gist-" :ignore t)
|
||||
|
||||
(defadvice! +gist--open-in-popup-a (orig-fn &rest args)
|
||||
(defadvice! +gist--open-in-popup-a (fn &rest args)
|
||||
:around #'gist-list-render
|
||||
(funcall orig-fn (car args) t)
|
||||
(funcall fn (car args) t)
|
||||
(unless (cadr args)
|
||||
(pop-to-buffer (current-buffer))))
|
||||
|
||||
|
|
|
@ -151,10 +151,10 @@ Dictionary.app behind the scenes to get definitions.")
|
|||
;; xref to be one too.
|
||||
(remove-hook 'xref-backend-functions #'etags--xref-backend)
|
||||
;; ...however, it breaks `projectile-find-tag', unless we put it back.
|
||||
(defadvice! +lookup--projectile-find-tag-a (orig-fn)
|
||||
(defadvice! +lookup--projectile-find-tag-a (fn)
|
||||
:around #'projectile-find-tag
|
||||
(let ((xref-backend-functions '(etags--xref-backend t)))
|
||||
(funcall orig-fn)))
|
||||
(funcall fn)))
|
||||
|
||||
;; This integration is already built into evil
|
||||
(unless (featurep! :editor evil)
|
||||
|
@ -170,12 +170,12 @@ Dictionary.app behind the scenes to get definitions.")
|
|||
|
||||
;; HACK Fix #4386: `ivy-xref-show-xrefs' calls `fetcher' twice, which has
|
||||
;; side effects that breaks in some cases (i.e. on `dired-do-find-regexp').
|
||||
(defadvice! +lookup--fix-ivy-xrefs (orig-fn fetcher alist)
|
||||
(defadvice! +lookup--fix-ivy-xrefs (fn fetcher alist)
|
||||
:around #'ivy-xref-show-xrefs
|
||||
(when (functionp fetcher)
|
||||
(setf (alist-get 'fetched-xrefs alist)
|
||||
(funcall fetcher)))
|
||||
(funcall orig-fn fetcher alist)))
|
||||
(funcall fn fetcher alist)))
|
||||
|
||||
(use-package! helm-xref
|
||||
:when (featurep! :completion helm))
|
||||
|
|
|
@ -27,7 +27,7 @@
|
|||
(after! flycheck
|
||||
(load! "autoload/flycheck-eglot")))
|
||||
|
||||
(defadvice! +lsp--defer-server-shutdown-a (orig-fn &optional server)
|
||||
(defadvice! +lsp--defer-server-shutdown-a (fn &optional server)
|
||||
"Defer server shutdown for a few seconds.
|
||||
This gives the user a chance to open other project files before the server is
|
||||
auto-killed (which is a potentially expensive process). It also prevents the
|
||||
|
@ -45,4 +45,4 @@ server getting expensively restarted when reverting buffers."
|
|||
(prog1 (funcall eglot-shutdown server)
|
||||
(+lsp-optimization-mode -1))))
|
||||
server)))
|
||||
(funcall orig-fn server))))
|
||||
(funcall fn server))))
|
||||
|
|
|
@ -73,14 +73,14 @@ about it (it will be logged to *Messages* however).")
|
|||
:implementations '(lsp-find-implementation :async t)
|
||||
:type-definition #'lsp-find-type-definition)
|
||||
|
||||
(defadvice! +lsp--respect-user-defined-checkers-a (orig-fn &rest args)
|
||||
(defadvice! +lsp--respect-user-defined-checkers-a (fn &rest args)
|
||||
"Ensure user-defined `flycheck-checker' isn't overwritten by `lsp'."
|
||||
:around #'lsp-diagnostics-flycheck-enable
|
||||
(if flycheck-checker
|
||||
(let ((old-checker flycheck-checker))
|
||||
(apply orig-fn args)
|
||||
(apply fn args)
|
||||
(setq-local flycheck-checker old-checker))
|
||||
(apply orig-fn args)))
|
||||
(apply fn args)))
|
||||
|
||||
(add-hook! 'lsp-mode-hook
|
||||
(defun +lsp-display-guessed-project-root-h ()
|
||||
|
@ -102,7 +102,7 @@ about it (it will be logged to *Messages* however).")
|
|||
(remq 'company-capf company-backends))))))))
|
||||
|
||||
(defvar +lsp--deferred-shutdown-timer nil)
|
||||
(defadvice! +lsp-defer-server-shutdown-a (orig-fn &optional restart)
|
||||
(defadvice! +lsp-defer-server-shutdown-a (fn &optional restart)
|
||||
"Defer server shutdown for a few seconds.
|
||||
This gives the user a chance to open other project files before the server is
|
||||
auto-killed (which is a potentially expensive process). It also prevents the
|
||||
|
@ -112,7 +112,7 @@ server getting expensively restarted when reverting buffers."
|
|||
restart
|
||||
(null +lsp-defer-shutdown)
|
||||
(= +lsp-defer-shutdown 0))
|
||||
(prog1 (funcall orig-fn restart)
|
||||
(prog1 (funcall fn restart)
|
||||
(+lsp-optimization-mode -1))
|
||||
(when (timerp +lsp--deferred-shutdown-timer)
|
||||
(cancel-timer +lsp--deferred-shutdown-timer))
|
||||
|
@ -123,11 +123,11 @@ server getting expensively restarted when reverting buffers."
|
|||
(with-lsp-workspace workspace
|
||||
(unless (lsp--workspace-buffers workspace)
|
||||
(let ((lsp-restart 'ignore))
|
||||
(funcall orig-fn))
|
||||
(funcall fn))
|
||||
(+lsp-optimization-mode -1))))
|
||||
lsp--cur-workspace))))
|
||||
|
||||
(defadvice! +lsp-dont-prompt-to-install-servers-maybe-a (orig-fn &rest args)
|
||||
(defadvice! +lsp-dont-prompt-to-install-servers-maybe-a (fn &rest args)
|
||||
:around #'lsp
|
||||
(when (buffer-file-name)
|
||||
(require 'lsp-mode)
|
||||
|
@ -136,7 +136,7 @@ server getting expensively restarted when reverting buffers."
|
|||
(-andfn #'lsp--matching-clients?
|
||||
#'lsp--server-binary-present?))
|
||||
(not (memq +lsp-prompt-to-install-server '(nil quiet))))
|
||||
(apply orig-fn args)
|
||||
(apply fn args)
|
||||
;; HACK `lsp--message' overrides `inhibit-message', so use `quiet!'
|
||||
(let ((doom-debug-p
|
||||
(or doom-debug-p
|
||||
|
@ -169,12 +169,12 @@ server getting expensively restarted when reverting buffers."
|
|||
(use-package! lsp-ui
|
||||
:hook (lsp-mode . lsp-ui-mode)
|
||||
:init
|
||||
(defadvice! +lsp--use-hook-instead-a (orig-fn &rest args)
|
||||
(defadvice! +lsp--use-hook-instead-a (fn &rest args)
|
||||
"Change `lsp--auto-configure' to not force `lsp-ui-mode' on us. Using a hook
|
||||
instead is more sensible."
|
||||
:around #'lsp--auto-configure
|
||||
(letf! ((#'lsp-ui-mode #'ignore))
|
||||
(apply orig-fn args)))
|
||||
(apply fn args)))
|
||||
|
||||
:config
|
||||
(when (featurep! +peek)
|
||||
|
|
|
@ -18,11 +18,11 @@
|
|||
(add-hook 'kill-buffer-hook #'+pdf-cleanup-windows-h nil t)))
|
||||
|
||||
:config
|
||||
(defadvice! +pdf--install-epdfinfo-a (orig-fn &rest args)
|
||||
(defadvice! +pdf--install-epdfinfo-a (fn &rest args)
|
||||
"Install epdfinfo after the first PDF file, if needed."
|
||||
:around #'pdf-view-mode
|
||||
(if (file-executable-p pdf-info-epdfinfo-program)
|
||||
(apply orig-fn args)
|
||||
(apply fn args)
|
||||
;; If we remain in pdf-view-mode, it'll spit out cryptic errors. This
|
||||
;; graceful failure is better UX.
|
||||
(fundamental-mode)
|
||||
|
@ -74,10 +74,10 @@
|
|||
nil 'local))))))
|
||||
|
||||
;; Silence "File *.pdf is large (X MiB), really open?" prompts for pdfs
|
||||
(defadvice! +pdf-suppress-large-file-prompts-a (orig-fn size op-type filename &optional offer-raw)
|
||||
(defadvice! +pdf-suppress-large-file-prompts-a (fn size op-type filename &optional offer-raw)
|
||||
:around #'abort-if-file-too-large
|
||||
(unless (string-match-p "\\.pdf\\'" filename)
|
||||
(funcall orig-fn size op-type filename offer-raw))))
|
||||
(funcall fn size op-type filename offer-raw))))
|
||||
|
||||
|
||||
(use-package! saveplace-pdf-view
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
;;; tools/prodigy/config.el -*- lexical-binding: t; -*-
|
||||
|
||||
(after! prodigy
|
||||
(defadvice! +prodigy--add-project-property-a (orig-fn &rest args)
|
||||
(defadvice! +prodigy--add-project-property-a (fn &rest args)
|
||||
"Adds a new :project property to prodigy services, which hides the service
|
||||
unless invoked from the relevant project."
|
||||
:around #'prodigy-services
|
||||
(let ((project-root (downcase (or (doom-project-root) default-directory)))
|
||||
(services (apply orig-fn args)))
|
||||
(services (apply fn args)))
|
||||
(if current-prefix-arg
|
||||
services
|
||||
(cl-remove-if-not (lambda (service)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue