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
Message #47 received at 5293 <at> debbugs.gnu.org (full text, mbox):
> @@ -299,7 +299,11 @@ unload-feature
> ;; Known abnormal hooks etc.
> (memq x unload-feature-special-hooks)))
> (dolist (func removables)
> - (remove-hook x func)))))
> + (remove-hook x func)
> + (save-current-buffer
> + (dolist (buffer (buffer-list))
> + (set-buffer buffer)
> + (remove-hook x func t)))))))
> ;; Remove any feature-symbols from auto-mode-alist as well.
> (dolist (func removables)
> (setq auto-mode-alist
Maybe instead of `(dolist (buffer (buffer-list))` within that big
`mapatoms` within `(dolist (func removables)` (which is O(B*F*V) where
B is the number of buffers, F is the number of functions and V is the
number of hook vars), we should instead do it as:
(dolist (buffer (buffer-list))
(dolist (varvar (buffer-local-variables buffer))
(when <var is a hook>
(dolist (func removables)
(remove-hook <var> func t)))))
If we need it to go faster maybe we could also arrange for (add-hook
V F ..) to do (cl-pushnew V (get F 'hooks-where-it-has-been-put)).
So we could do
(let ((relevant-hooks
(mapcan (lambda (f) (get F 'hooks-where-it-has-been-put)) funcs)))
(dolist (buffer (buffer-list))
(dolist (varvar (buffer-local-variables buffer))
(when (memq var relevant-hooks)
(dolist (func removables)
(remove-hook <var> func t)))))
-- Stefan
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.