[emacs-berlin] Understanding hooks

Michael Heerdegen michael_heerdegen at web.de
Fri Sep 13 15:02:00 UTC 2024


jman <emacs-berlin at city17.xyz> writes:

> [...] Quoting:
>
> "The optional fourth argument, LOCAL, if non-nil, says to modify
> the hook’s buffer-local value rather than its global value.
> This makes the hook buffer-local and it makes t a member of the
> buffer-local value. That acts as a flag to run the hook
> functions of the global value as well as in the local value."
>
> I find this verbiage a bit confusing: does the global hook runs in
> the current buffer or not with LOCAL `t`?

It does.

If you add to the local hook, Emacs automatically adds the t entry to
the binding.  And both the local and the global hook will be run.


> ;; Don't do anything when saving an email
> (remove-hook 'mu4e-compose-mode-hook 'before-save-hook t)

Something's not right here: You are trying to remove a hook from a hook!
`before-save-hook' is not a function and not a member of
`mu4e-compose-mode-hook' (at least it should not be!).

What did you try to achieve here?


Michael.


More information about the emacs-berlin mailing list