Subject: bug#5293: 23.1; unload-feature on buffer-local hooks

From: Juanma Barranquero <[email-masked]>
Date: Sun, 3 Jan 2010 00:14:31 +0100

On Sat, Jan 2, 2010 at 22:06, Kevin Ryde <[email-masked]> wrote:

> When `unload-feature' looks in hooks for functions that it's going to
> unload, it doesn't seem to look in buffer-local values, other than for
> the current buffer.
[...]
> I suppose looking in all buffers is more work for unload-feature, but
> would be a good protection against bad things happening later.

Yes, unload-feature should look at buffer-local values, too.

For the moment being, a package like foo should define a function (foo
in the function name matches the feature name you're unloading):

(defun foo-unload-function ()
  ;; do whatever is necessary; in foo's case:
  (with-current-buffer (get-buffer "foo-bufer")
    (remove-hook 'after-change-functions 'foo-message t))
  ;; continue standard unloading
  nil)

that will be automatically called upon unloading foo.el; in most
cases, it should return nil to allow unload-feature to continue the
normal unloading process.

    Juanma