unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
From: edef <edef@edef.eu>
To: notmuch@notmuchmail.org, david@tethera.net
Cc: edef <edef@edef.eu>
Subject: [PATCH] emacs: remap send-message and send-message-and-exit
Date: Tue,  1 Jun 2021 06:15:02 +0000	[thread overview]
Message-ID: <20210601061501.115217-1-edef@edef.eu> (raw)
In-Reply-To: <875yyymqvk.fsf@tethera.net>

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
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)
     (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-01  6:16 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   ` edef [this message]
2021-06-02 19:03     ` [PATCH] emacs: remap send-message and send-message-and-exit Tomi Ollila
2021-06-04 16:50       ` edef
2021-06-07 16:09         ` Tomi Ollila
2021-06-13  8:23           ` [PATCH v2] " edef
2021-06-27 17:25             ` 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=20210601061501.115217-1-edef@edef.eu \
    --to=edef@edef.eu \
    --cc=david@tethera.net \
    --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).