diff options
author | Štěpán Němec <stepnem@gmail.com> | 2020-04-06 13:30:11 +0200 |
---|---|---|
committer | Štěpán Němec <stepnem@gmail.com> | 2020-10-21 18:51:12 +0200 |
commit | 5c266a71c160ed823e9ef69d2ff44fb0bb81ff77 (patch) | |
tree | 30d0961316f3dd3dbe5750b8c308cc0c7153afea /lisp | |
parent | 0e9e36747f060a52ce4ecbf48eeb8421d4a19c68 (diff) | |
download | emacs-5c266a71c160ed823e9ef69d2ff44fb0bb81ff77.tar.gz emacs-5c266a71c160ed823e9ef69d2ff44fb0bb81ff77.tar.bz2 emacs-5c266a71c160ed823e9ef69d2ff44fb0bb81ff77.zip |
unload-feature: Handle local hooks (bug#5293)
Buffer-local hooks were introduced in
1994-09-30T20:47:13+00:00!rms@gnu.org
0e4d378b32 (add-hook): Initialize default value and local value.
but 'unload-feature' has not been updated to handle them.
* lisp/loadhist.el (unload-feature): Handle local hooks (bug#5293).
Diffstat (limited to 'lisp')
-rw-r--r-- | lisp/loadhist.el | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/lisp/loadhist.el b/lisp/loadhist.el index 60da00cceb2..81576679c35 100644 --- a/lisp/loadhist.el +++ b/lisp/loadhist.el @@ -300,6 +300,15 @@ something strange, such as redefining an Emacs function." (memq x unload-feature-special-hooks))) (dolist (func removables) (remove-hook x func))))) + (save-current-buffer + (dolist (buffer (buffer-list)) + (pcase-dolist (`(,sym . ,val) (buffer-local-variables buffer)) + (when (or (and (consp val) + (string-match "-hooks?\\'" (symbol-name sym))) + (memq sym unload-feature-special-hooks)) + (set-buffer buffer) + (dolist (func removables) + (remove-hook sym func t)))))) ;; Remove any feature-symbols from auto-mode-alist as well. (dolist (func removables) (setq auto-mode-alist |