bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#34686: 26.1; unload-feature doesn't remove functions locally from ho


From: Braun Gábor
Subject: bug#34686: 26.1; unload-feature doesn't remove functions locally from hooks
Date: Thu, 28 Feb 2019 21:08:44 +0100

> > IMHO, the stated reason in the info manual (keep Emacs functioning)
> > justifies removing functions from the hooks (both their global and 
local
> > values) which become undefined.
> 
> Yes, Iʼd tend to agree. Would you have a patch to offer?

What about the following?

Gábor

--- lisp/loadhist.el    2019-02-28 20:52:14.852487704 +0100
+++ lisp/loadhist.el    2019-02-28 20:51:40.008386599 +0100
@@ -295,7 +295,13 @@
             (dolist (y unload-function-defs-list)
               (when (and (eq (car-safe y) 'defun)
                          (not (get (cdr y) 'autoload)))
-                (remove-hook x (cdr y)))))))
+                (let ((f (cdr y)))
+                  (remove-hook x f)
+                  ;; Remove also from buffer-local value.
+                  (save-current-buffer
+                    (dolist (buf (buffer-list))
+                      (set-buffer buf)
+                      (remove-hook x f t)))))))))
        ;; Remove any feature-symbols from auto-mode-alist as well.
        (dolist (y unload-function-defs-list)
          (when (and (eq (car-safe y) 'defun)








reply via email to

[Prev in Thread] Current Thread [Next in Thread]