GNU bug report logs - #34686
26.1; unload-feature doesn't remove functions locally from hooks

Previous Next

Package: emacs;

Reported by: Braun Gábor <braungb88 <at> gmail.com>

Date: Thu, 28 Feb 2019 16:21:02 UTC

Severity: minor

Merged with 5293

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


Message #17 received at 34686 <at> debbugs.gnu.org (full text, mbox):

From: Braun Gábor <braungb88 <at> gmail.com>
To: Robert Pluim <rpluim <at> gmail.com>
Cc: 34686 <at> debbugs.gnu.org
Subject: Re: 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)







This bug report was last modified 4 years and 213 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.