]> rtime.felk.cvut.cz Git - notmuch.git/commit
emacs: Fix regression in (notmuch-)message-mode initialization notmuch-message-mode-fix
authorMichal Sojka <sojkam1@fel.cvut.cz>
Tue, 3 Nov 2015 17:03:08 +0000 (18:03 +0100)
committerMichal Sojka <sojkam1@fel.cvut.cz>
Sun, 20 Dec 2015 23:24:26 +0000 (00:24 +0100)
commitefb24ce1059efc1f7605420e5bc23f47cbbad8f4
tree2cffa935bd7c3d2ba540e7416c547aea352c3062
parent8881a61fe7a1956534b89cd1f79984793ff694fe
emacs: Fix regression in (notmuch-)message-mode initialization

TODO

Recent addition of notmuch-message-mode introduced a few regressions.
I use message-setup-hook to set some buffer local variables and this
stopped working. The reason is that notmuch-message-mode, which cleans
all buffer local variables, is called after calling message-mail,
which calls the message-setup-hook. Another problem with the previous
implementation might be that the message-mode-hook is called twice -
first when message-mail calls message-mode and second when
notmuch-message-mode calls it. This can be problematic when the hook
has side effects.

This commit uses advice mechanism to call notmuch-message-mode instead
of message-mode. This way, a call to message-mail initializes directly
notmuch-message-mode rather than message-mode which is later changed
to notmuch-message-mode. The advice is constructed in such a way, that
it is effective only once and when called by notmuch. The second call
to message-mode (from notmuch-message-mode) calls the original
message-mode.

This implementation uses the new advice mechanism introduced in Emacs
24.4. If we want to support older version, this must be changed.
emacs/notmuch-mua.el