all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: "Braun Gábor" <braungb88@gmail.com>
To: Robert Pluim <rpluim@gmail.com>
Cc: 34686@debbugs.gnu.org
Subject: bug#34686: 26.1; unload-feature doesn't remove functions locally from hooks
Date: Thu, 28 Feb 2019 21:08:44 +0100	[thread overview]
Message-ID: <2634596.5C4bGIA8oR@gabor> (raw)
In-Reply-To: <m2sgw71z6k.fsf@gmail.com>

> > 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	other threads:[~2019-02-28 20:08 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-02-23 21:16 bug#34686: 26.1; unload-feature doesn't remove functions locally from hooks Braun Gábor
2019-02-28 18:03 ` Eli Zaretskii
2019-02-28 19:03   ` Robert Pluim
     [not found]     ` <1551386357.RvjfsdQ5jE@gabor>
2019-02-28 19:38       ` Robert Pluim
2019-02-28 20:08         ` Braun Gábor [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=2634596.5C4bGIA8oR@gabor \
    --to=braungb88@gmail.com \
    --cc=34686@debbugs.gnu.org \
    --cc=rpluim@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.