From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp0 ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms11 with LMTPS id 0BznDS5IrF8tWwAA0tVLHw (envelope-from ) for ; Wed, 11 Nov 2020 20:23:10 +0000 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp0 with LMTPS id yJHJCS5IrF9OTgAA1q6Kng (envelope-from ) for ; Wed, 11 Nov 2020 20:23:10 +0000 Received: from mail.notmuchmail.org (nmbug.tethera.net [IPv6:2607:5300:201:3100::1657]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (2048 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 2AACB94091B for ; Wed, 11 Nov 2020 20:23:09 +0000 (UTC) Received: from nmbug.tethera.net (localhost [127.0.0.1]) by mail.notmuchmail.org (Postfix) with ESMTP id B98E528C03; Wed, 11 Nov 2020 15:23:01 -0500 (EST) Received: from jb55.com (jb55.com [IPv6:2600:3c01::f03c:91ff:fe08:5bfb]) by mail.notmuchmail.org (Postfix) with ESMTPS id 6DDE5270EF for ; Wed, 11 Nov 2020 15:22:59 -0500 (EST) Received: from jb55.com (S010660e327dca171.vc.shawcable.net [24.84.152.187]) by jb55.com (OpenSMTPD) with ESMTPSA id 9f6ba55a (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256:NO); Wed, 11 Nov 2020 20:23:45 +0000 (UTC) From: William Casarin To: Jonas Bernoulli , notmuch@notmuchmail.org Subject: Re: [PATCH 02/27] emacs: define notmuch-message-mode-map explicitly In-Reply-To: <20201108190311.1397-3-jonas@bernoul.li> References: <20201108190311.1397-1-jonas@bernoul.li> <20201108190311.1397-3-jonas@bernoul.li> Date: Wed, 11 Nov 2020 12:22:57 -0800 Message-ID: <87zh3n8wym.fsf@jb55.com> MIME-Version: 1.0 Message-ID-Hash: IWK3SMRGMD4A5VVDWBLS5WEPFTJH5AB2 X-Message-ID-Hash: IWK3SMRGMD4A5VVDWBLS5WEPFTJH5AB2 X-MailFrom: jb55@jb55.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-notmuch.notmuchmail.org-0; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; suspicious-header X-Mailman-Version: 3.2.1 Precedence: list List-Id: "Use and development of the notmuch mail system." List-Help: List-Post: List-Subscribe: List-Unsubscribe: Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Scanner: ns3122888.ip-94-23-21.eu Authentication-Results: aspmx1.migadu.com; dkim=none; dmarc=none; spf=pass (aspmx1.migadu.com: domain of notmuch-bounces@notmuchmail.org designates 2607:5300:201:3100::1657 as permitted sender) smtp.mailfrom=notmuch-bounces@notmuchmail.org X-Spam-Score: -1.01 X-TUID: 7PVzd62Mj+l4 Jonas Bernoulli writes: > Key bindings should not be defined at the top-level but inside > a `defvar' form. Doing it at the top-level makes it harder to > reliably customize key bindings. > --- > emacs/notmuch-mua.el | 14 +++++++++----- > 1 file changed, 9 insertions(+), 5 deletions(-) > > diff --git a/emacs/notmuch-mua.el b/emacs/notmuch-mua.el > index 03c7cc97..616b625c 100644 > --- a/emacs/notmuch-mua.el > +++ b/emacs/notmuch-mua.el > @@ -324,17 +324,21 @@ (defun notmuch-mua-reply (query-string &optional sender reply-all) > (message-goto-body) > (set-buffer-modified-p nil)) > > +(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 (kbd "C-c C-p") #'notmuch-draft-postpone) > + (define-key map (kbd "C-x C-s") #'notmuch-draft-save) > + map) > + "Keymap for `notmuch-message-mode'.") > + > (define-derived-mode notmuch-message-mode message-mode "Message[Notmuch]" > "Notmuch message composition mode. Mostly like `message-mode'." > (notmuch-address-setup)) > > (put 'notmuch-message-mode 'flyspell-mode-predicate 'mail-mode-flyspell-verify) > > -(define-key notmuch-message-mode-map (kbd "C-c C-c") #'notmuch-mua-send-and-exit) > -(define-key notmuch-message-mode-map (kbd "C-c C-s") #'notmuch-mua-send) > -(define-key notmuch-message-mode-map (kbd "C-c C-p") #'notmuch-draft-postpone) > -(define-key notmuch-message-mode-map (kbd "C-x C-s") #'notmuch-draft-save) > - > (defun notmuch-mua-pop-to-buffer (name switch-function) > "Pop to buffer NAME, and warn if it already exists and is > modified. This function is notmuch adaptation of Tested-by: William Casarin