GNU bug report logs -
#5293
23.1; unload-feature on buffer-local hooks
Previous Next
Reported by: Kevin Ryde <user42 <at> zip.com.au>
Date: Sat, 2 Jan 2010 21:07:02 UTC
Severity: minor
Merged with 34686
Found in version 26.1
Done: Štěpán Němec <stepnem <at> gmail.com>
Bug is archived. No further changes may be made.
Full log
View this message in rfc822 format
Štěpán Němec <stepnem <at> gmail.com> writes:
> So I guess my defeatism will not prevail after all. Updated [2/3] attached.
The patch no longer applied to the trunk, and it referred to a variable
called `removables' that I couldn't find. So I've respun it (included
below), but not tested.
Any comments?
diff --git a/etc/NEWS b/etc/NEWS
index b4f29ab783..993cb3ca85 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -215,6 +215,9 @@ preserving markers, properties and overlays. The new variable
number of seconds that 'revert-buffer-with-fine-grain' should spend
trying to be non-destructive.
+---
+** 'unload-feature' now also tries to undo additions to buffer-local hooks.
+
* Changes in Specialized Modes and Packages in Emacs 28.1
diff --git a/lisp/loadhist.el b/lisp/loadhist.el
index a1ff2f6270..6f2e313f71 100644
--- a/lisp/loadhist.el
+++ b/lisp/loadhist.el
@@ -297,6 +297,16 @@ unload-feature
(when (and (eq (car-safe y) 'defun)
(not (get (cdr y) 'autoload)))
(remove-hook x (cdr y)))))))
+ ;; Handle buffer-local hooks.
+ (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 unload-function-defs-list)
+ (remove-hook sym func t))))))
;; Remove any feature-symbols from auto-mode-alist as well.
(dolist (y unload-function-defs-list)
(when (and (eq (car-safe y) 'defun)
--
(domestic pets only, the antidote for overdose, milk.)
bloggy blog: http://lars.ingebrigtsen.no
This bug report was last modified 4 years and 214 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.