Re: [PATCH] emacs: remap send-message and send-message-and-exit

Subject: Re: [PATCH] emacs: remap send-message and send-message-and-exit

Date: Wed, 02 Jun 2021 22:03:46 +0300

To: edef, notmuch@notmuchmail.org, david@tethera.net

Cc: edef

From: Tomi Ollila


On Tue, Jun 01 2021, edef@edef.eu wrote:

> All three of C-c C-c, <menu-bar> <Message> <Send Message>,
> and <tool-bar> <Send Message> are bound to message-send-and-exit by
> message.el, but notmuch-mua.el only had an explicit override for the
> keyboard binding. This mostly manifests as confusing Fcc behaviour for
> GUI users.
>
> Patching the bindings for specific keys is rather brittle, since it has
> to be aware of every relevant binding. This patch switches to instead

After committed to repo this is no longer 'patch'. Simple change
is to use 'commit', 'change', 'changeset' -- alternative is not
to write 'This ...' but reword...

> using a remap binding, which turns any binding for message-send or
> message-send-and-exit into a binding for the corresponding notmuch-mua
> command.
> ---
> The previous patch managed to *disappear* the menu item, but while
> figuring out how to make that work correctly, I happened upon a much
> simpler and less brittle solution.
>
>  emacs/notmuch-mua.el | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/emacs/notmuch-mua.el b/emacs/notmuch-mua.el
> index bbf059a2..8572aa1b 100644
> --- a/emacs/notmuch-mua.el
> +++ b/emacs/notmuch-mua.el
> @@ -341,8 +341,8 @@ Typically this is added to `notmuch-mua-send-hook'."
>  
>  (defvar notmuch-message-mode-map
>    (let ((map (make-sparse-keymap)))
> -    (define-key map (kbd "C-c C-c") #'notmuch-mua-send-and-exit)
> -    (define-key map (kbd "C-c C-s") #'notmuch-mua-send)
> +    (define-key map [remap message-send-and-exit] 'notmuch-mua-send-and-exit)
> +    (define-key map [remap message-send] 'notmuch-mua-send)

where did the # characters disappear here ?

afaic #' is the recommended way here...

>      (define-key map (kbd "C-c C-p") #'notmuch-draft-postpone)
>      (define-key map (kbd "C-x C-s") #'notmuch-draft-save)
>      map)
> -- 
> 2.31.1

Tomi
_______________________________________________
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-leave@notmuchmail.org

Thread: