Move toggle-advice to its own section
This commit is contained in:
parent
fa47364def
commit
d5f3b42584
28
README.org
28
README.org
@ -353,6 +353,24 @@ However, in order to improve visibility, it relies on:
|
|||||||
"My face to show a here-document."))
|
"My face to show a here-document."))
|
||||||
#+end_src
|
#+end_src
|
||||||
|
|
||||||
|
** [[info:elisp#Advising Functions][Advising Functions (info)]]
|
||||||
|
|
||||||
|
#+caption[Tools for advising functions]:
|
||||||
|
#+caption: Tools for advising functions.
|
||||||
|
#+name: lst:advising-tools
|
||||||
|
#+begin_src emacs-lisp
|
||||||
|
(with-eval-after-load 'emacs
|
||||||
|
(defun toggle-advice (symbol where function &optional props)
|
||||||
|
"Toggle between states after `advice-remove' and `advice-add'."
|
||||||
|
(let ((how "%s `%s' advice `%s' %s `%s'"))
|
||||||
|
(if (advice-member-p function symbol)
|
||||||
|
(progn
|
||||||
|
(message how "Removal of" where function "from" symbol)
|
||||||
|
(advice-remove symbol function))
|
||||||
|
(message how "Addition of" where function "to" symbol)
|
||||||
|
(advice-add symbol where function props)))))
|
||||||
|
#+end_src
|
||||||
|
|
||||||
** [[info:emacs#Dired][Dired: directory editor as file manager (info)]]
|
** [[info:emacs#Dired][Dired: directory editor as file manager (info)]]
|
||||||
:PROPERTIES:
|
:PROPERTIES:
|
||||||
:CUSTOM_ID: sec:file-manager
|
:CUSTOM_ID: sec:file-manager
|
||||||
@ -1336,16 +1354,6 @@ corrects this by advising to override ~TeX-brace-count-line~ with
|
|||||||
(forward-char) t))))))
|
(forward-char) t))))))
|
||||||
count)))
|
count)))
|
||||||
|
|
||||||
(defun toggle-advice (symbol where function &optional props)
|
|
||||||
"Toggle between states after `advice-remove' and `advice-add'."
|
|
||||||
(let ((how "%s `%s' advice `%s' %s `%s'"))
|
|
||||||
(if (advice-member-p function symbol)
|
|
||||||
(progn
|
|
||||||
(message how "Removal of" where function "from" symbol)
|
|
||||||
(advice-remove symbol function))
|
|
||||||
(message how "Addition of" where function "to" symbol)
|
|
||||||
(advice-add symbol where function props))))
|
|
||||||
|
|
||||||
(defun toggle-TeX-brace-count-line-override ()
|
(defun toggle-TeX-brace-count-line-override ()
|
||||||
"Toggle `TeX-brace-count-line-override' advice."
|
"Toggle `TeX-brace-count-line-override' advice."
|
||||||
(interactive)
|
(interactive)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user