slight workaround needed to use gnus-alias

Sanjoy Mahajan sanjoy at olin.edu
Thu May 12 08:11:55 PDT 2016


(I am using notmuch 0.22 from the Debian 0.22-1 package, in Emacs 24.5.1.)

I start gnus-alias in my message-setup-hook:

  (add-hook 'message-setup-hook 'gnus-alias-determine-identity)

That worked fine until recently.  Now it fails with the following error
(in the *Messages* buffer and minibuffer):

  apply: Must be in `message-mode'.? 

The problem is the following in gnus-alias.el:

  (defun gnus-alias-ensure-message-mode ()
    "Assert that the current buffer is a message buffer."
    (when (not (eq major-mode 'message-mode))
      (gnus-alias-error "Must be in `message-mode'.? ")))

The latest notmuch-mua.el doesn't use message-mode directly but rather
defines a derived mode:

  (define-derived-mode notmuch-message-mode message-mode "Message[Notmuch]"
    "Notmuch message composition mode. Mostly like `message-mode'"
    (when notmuch-address-command
      (notmuch-address-setup)))

I'm not sure what the best fix is.  But I've done the following, which
works for me:

(require 'gnus-alias)
(gnus-alias-init)
;;; upstream version checks just for message-mode, but notmuch uses
;;; notmuch-message-mode, which is derived from message-mode
(defun gnus-alias-ensure-message-mode ()
  "Assert that the current buffer is a message buffer."
  (when (not (derived-mode-p 'notmuch-message-mode))
    (gnus-alias-error "Must be in `message-mode' or mode derived from it. ")))
(add-hook 'message-setup-hook 'gnus-alias-determine-identity)

-- 
-Sanjoy

<http://savelongwharfpark.org/>
Save Long Wharf Park in Boston Harbor!

<http://streetfightingmath.com/>
Six reasoning tools to make hard problems easy.


More information about the notmuch mailing list