unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
From: edef <edef@edef.eu>
To: notmuch@notmuchmail.org
Cc: edef <edef@edef.eu>
Subject: [PATCH v2] emacs: remap send-message and send-message-and-exit
Date: Sun, 13 Jun 2021 08:23:58 +0000	[thread overview]
Message-ID: <20210613082357.76606-1-edef@edef.eu> (raw)
In-Reply-To: <m2k0n5k66b.fsf@guru.guru-group.fi>

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 change switches to instead
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.
---
Fixed up the nits reported by Tomi Ollila.

 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..17954fb3 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)
     (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

  reply	other threads:[~2021-06-13  8:24 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-30 10:28 [PATCH] emacs: rebind the "Send Message" toolbar/menu items edef
2021-05-31 23:21 ` David Bremner
2021-06-01  6:15   ` [PATCH] emacs: remap send-message and send-message-and-exit edef
2021-06-02 19:03     ` Tomi Ollila
2021-06-04 16:50       ` edef
2021-06-07 16:09         ` Tomi Ollila
2021-06-13  8:23           ` edef [this message]
2021-06-27 17:25             ` [PATCH v2] " David Bremner

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://notmuchmail.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210613082357.76606-1-edef@edef.eu \
    --to=edef@edef.eu \
    --cc=notmuch@notmuchmail.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).