unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
* slight workaround needed to use gnus-alias
@ 2016-05-12 15:11 Sanjoy Mahajan
  2016-05-12 15:55 ` David Bremner
  0 siblings, 1 reply; 6+ messages in thread
From: Sanjoy Mahajan @ 2016-05-12 15:11 UTC (permalink / raw)
  To: notmuch

(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.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: slight workaround needed to use gnus-alias
  2016-05-12 15:11 slight workaround needed to use gnus-alias Sanjoy Mahajan
@ 2016-05-12 15:55 ` David Bremner
  2016-05-12 16:10   ` Sanjoy Mahajan
  0 siblings, 1 reply; 6+ messages in thread
From: David Bremner @ 2016-05-12 15:55 UTC (permalink / raw)
  To: Sanjoy Mahajan, notmuch

Sanjoy Mahajan <sanjoy@olin.edu> writes:

>
> (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)

Maybe upstream Emacs would accept something like that if it says
"(derived-mode-p 'message-mode)".

d

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: slight workaround needed to use gnus-alias
  2016-05-12 15:55 ` David Bremner
@ 2016-05-12 16:10   ` Sanjoy Mahajan
  2016-05-12 16:23     ` David Bremner
  0 siblings, 1 reply; 6+ messages in thread
From: Sanjoy Mahajan @ 2016-05-12 16:10 UTC (permalink / raw)
  To: David Bremner, notmuch

On 2016-05-12 11:55, David Bremner <david@tethera.net> wrote:

>> (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)
>
> Maybe upstream Emacs would accept something like that if it says
> "(derived-mode-p 'message-mode)".

Agreed!  That's what I meant to write (a yank bug somewhere along the line).

I am happy to ask upstream on the emacs list, unless you think it would
be more likely to be accepted if coming from notmuch developers.

-Sanjoy

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: slight workaround needed to use gnus-alias
  2016-05-12 16:10   ` Sanjoy Mahajan
@ 2016-05-12 16:23     ` David Bremner
  2016-05-13 14:58       ` Sanjoy Mahajan
  0 siblings, 1 reply; 6+ messages in thread
From: David Bremner @ 2016-05-12 16:23 UTC (permalink / raw)
  To: Sanjoy Mahajan, notmuch

Sanjoy Mahajan <sanjoy@olin.edu> writes:

>
> Agreed!  That's what I meant to write (a yank bug somewhere along the line).
>
> I am happy to ask upstream on the emacs list, unless you think it would
> be more likely to be accepted if coming from notmuch developers.
>
> -Sanjoy

I'd suggest submitting a feature request with M-x report-bug, and we can follow on
the bug if clarification is needed.

David

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: slight workaround needed to use gnus-alias
  2016-05-12 16:23     ` David Bremner
@ 2016-05-13 14:58       ` Sanjoy Mahajan
  2016-05-13 22:45         ` David Bremner
  0 siblings, 1 reply; 6+ messages in thread
From: Sanjoy Mahajan @ 2016-05-13 14:58 UTC (permalink / raw)
  To: David Bremner, notmuch

On 2016-05-12 12:23, David Bremner <david@tethera.net> wrote:

> I'd suggest submitting a feature request with M-x report-bug, and we
> can follow on the bug if clarification is needed.

Upon further investigation, I found that gnus-alias.el isn't part of
emacs itself but is an addon (on the Emacswiki).  So, I wrote to its
author with the suggested change.

-Sanjoy

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: slight workaround needed to use gnus-alias
  2016-05-13 14:58       ` Sanjoy Mahajan
@ 2016-05-13 22:45         ` David Bremner
  0 siblings, 0 replies; 6+ messages in thread
From: David Bremner @ 2016-05-13 22:45 UTC (permalink / raw)
  To: Sanjoy Mahajan, notmuch

Sanjoy Mahajan <sanjoy@olin.edu> writes:

> On 2016-05-12 12:23, David Bremner <david@tethera.net> wrote:
>
>> I'd suggest submitting a feature request with M-x report-bug, and we
>> can follow on the bug if clarification is needed.
>
> Upon further investigation, I found that gnus-alias.el isn't part of
> emacs itself but is an addon (on the Emacswiki).  So, I wrote to its
> author with the suggested change.
>
> -Sanjoy

Thanks for letting us know.

David

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2016-05-13 22:45 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-05-12 15:11 slight workaround needed to use gnus-alias Sanjoy Mahajan
2016-05-12 15:55 ` David Bremner
2016-05-12 16:10   ` Sanjoy Mahajan
2016-05-12 16:23     ` David Bremner
2016-05-13 14:58       ` Sanjoy Mahajan
2016-05-13 22:45         ` David Bremner

Code repositories for project(s) associated with this public inbox

	https://yhetil.org/notmuch.git/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).