From: Austin Clements Date: Sun, 15 Sep 2013 15:36:42 +0000 (+2000) Subject: Re: [PATCH] contrib: pick: use global keymap X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=b4cf001497f113ef3c3ae5e0a418e57c09aeae9b;p=notmuch-archives.git Re: [PATCH] contrib: pick: use global keymap --- diff --git a/96/bb98cc3b58f2977d87e9988d55687a0654e088 b/96/bb98cc3b58f2977d87e9988d55687a0654e088 new file mode 100644 index 000000000..318c12535 --- /dev/null +++ b/96/bb98cc3b58f2977d87e9988d55687a0654e088 @@ -0,0 +1,151 @@ +Return-Path: +X-Original-To: notmuch@notmuchmail.org +Delivered-To: notmuch@notmuchmail.org +Received: from localhost (localhost [127.0.0.1]) + by olra.theworths.org (Postfix) with ESMTP id DB607431FAF + for ; Sun, 15 Sep 2013 08:36:54 -0700 (PDT) +X-Virus-Scanned: Debian amavisd-new at olra.theworths.org +X-Spam-Flag: NO +X-Spam-Score: -0.7 +X-Spam-Level: +X-Spam-Status: No, score=-0.7 tagged_above=-999 required=5 + tests=[RCVD_IN_DNSWL_LOW=-0.7] autolearn=disabled +Received: from olra.theworths.org ([127.0.0.1]) + by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024) + with ESMTP id YSUuzpQwMwcF for ; + Sun, 15 Sep 2013 08:36:48 -0700 (PDT) +Received: from dmz-mailsec-scanner-3.mit.edu (dmz-mailsec-scanner-3.mit.edu + [18.9.25.14]) + by olra.theworths.org (Postfix) with ESMTP id 90D99431FAE + for ; Sun, 15 Sep 2013 08:36:48 -0700 (PDT) +X-AuditID: 1209190e-b7f988e0000009a7-b3-5235d40fa775 +Received: from mailhub-auth-2.mit.edu ( [18.7.62.36]) + by dmz-mailsec-scanner-3.mit.edu (Symantec Messaging Gateway) with SMTP + id 34.88.02471.F04D5325; Sun, 15 Sep 2013 11:36:47 -0400 (EDT) +Received: from outgoing.mit.edu (outgoing-auth-1.mit.edu [18.9.28.11]) + by mailhub-auth-2.mit.edu (8.13.8/8.9.2) with ESMTP id r8FFakQk013726; + Sun, 15 Sep 2013 11:36:47 -0400 +Received: from awakening.csail.mit.edu (awakening.csail.mit.edu [18.26.4.91]) + (authenticated bits=0) + (User authenticated as amdragon@ATHENA.MIT.EDU) + by outgoing.mit.edu (8.13.8/8.12.4) with ESMTP id r8FFah2x019488 + (version=TLSv1/SSLv3 cipher=DHE-RSA-AES128-SHA bits=128 verify=NOT); + Sun, 15 Sep 2013 11:36:45 -0400 +Received: from amthrax by awakening.csail.mit.edu with local (Exim 4.80) + (envelope-from ) + id 1VLENP-000106-E0; Sun, 15 Sep 2013 11:36:43 -0400 +Date: Sun, 15 Sep 2013 11:36:42 -0400 +From: Austin Clements +To: Mark Walters +Subject: Re: [PATCH] contrib: pick: use global keymap +Message-ID: <20130915153642.GY1426@mit.edu> +References: <1379233068-9626-1-git-send-email-markwalters1009@gmail.com> +MIME-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +Content-Disposition: inline +In-Reply-To: <1379233068-9626-1-git-send-email-markwalters1009@gmail.com> +User-Agent: Mutt/1.5.21 (2010-09-15) +X-Brightmail-Tracker: + H4sIAAAAAAAAA+NgFmpileLIzCtJLcpLzFFi42IRYrdT0eW/YhpksOiPlcXquTwW12/OZHZg + 8tg56y67x7NVt5gDmKK4bFJSczLLUov07RK4Miavm8VYcFm24umkDsYGxpkSXYycHBICJhIX + v5xih7DFJC7cW8/WxcjFISSwj1Hiyo2/UM5GRokdp5azglQJCZxmktjY5QyRWMIosf/2fxaQ + BIuAqkTbijXMIDabgIbEtv3LGUFsEQEdiduHFoCtYBaQlvj2u5kJxBYWMJW49+0ZWA2vgLZE + 3/Nd7BALPCQ+re5jhYgLSpyc+YQFoldL4sa/l0C9HGBzlv/jAAlzCnhKTJk6G2ykqICKxJST + 29gmMArNQtI9C0n3LITuBYzMqxhlU3KrdHMTM3OKU5N1i5MT8/JSi3SN9XIzS/RSU0o3MYKC + mlOSbwfj14NKhxgFOBiVeHhXXDAJEmJNLCuuzD3EKMnBpCTKG3zONEiILyk/pTIjsTgjvqg0 + J7X4EKMEB7OSCO8mJaAcb0piZVVqUT5MSpqDRUmcd72TfpCQQHpiSWp2ampBahFMVoaDQ0mC + V/gyUKNgUWp6akVaZk4JQpqJgxNkOA/Q8D2XQIYXFyTmFmemQ+RPMSpKifMygzQLgCQySvPg + emFJ5xWjONArwrwPQdp5gAkLrvsV0GAmoMGbdxuBDC5JREhJNTCKOz68dSHId9nf60IV/8J2 + 3oiazv27SyRP4TGP5POpmQyO58/lfDtv2Bx54Flb97EemYei6QHpOQwHfj9dUBO3WvzCf6sb + 5VOyOzjXnLA+9+J8/sq45WmeGRUzLWT/my472b/o/Rx/EbXFd53Mv+ZMm3qJtYBZYp2BSFTv + l71Z6/ZkJU9zkp2qxFKckWioxVxUnAgAzoD7KhUDAAA= +Cc: notmuch@notmuchmail.org +X-BeenThere: notmuch@notmuchmail.org +X-Mailman-Version: 2.1.13 +Precedence: list +List-Id: "Use and development of the notmuch mail system." + +List-Unsubscribe: , + +List-Archive: +List-Post: +List-Help: +List-Subscribe: , + +X-List-Received-Date: Sun, 15 Sep 2013 15:36:55 -0000 + +Quoth Mark Walters on Sep 15 at 9:17 am: +> Austin recently introduced a new global keymap. This makes pick use +> this global map. +> +> In most cases pick needs to override this global map because +> it wants to close the message pane before doing the action. However, +> this documents the over-rides and makes it less likely that the pick +> bindings will get out of sync with the main bindings. +> --- +> contrib/notmuch-pick/notmuch-pick.el | 16 ++++++++++++---- +> 1 files changed, 12 insertions(+), 4 deletions(-) +> +> diff --git a/contrib/notmuch-pick/notmuch-pick.el b/contrib/notmuch-pick/notmuch-pick.el +> index cba9549..01ca4bd 100644 +> --- a/contrib/notmuch-pick/notmuch-pick.el +> +++ b/contrib/notmuch-pick/notmuch-pick.el +> @@ -230,6 +230,17 @@ FUNC." +> +> (defvar notmuch-pick-mode-map +> (let ((map (make-sparse-keymap))) +> + (set-keymap-parent map notmuch-common-keymap) +> + ;; The following override the global keymap. +> + ;; Override because we want to close message pane first. +> + (define-key map "?" (notmuch-pick-close-message-pane-and #'notmuch-help)) + +Sorry I didn't look at this earlier. + +(define-key map [remap notmuch-help] + (notmuch-pick-close-message-pane-and #'notmuch-help)) +? (And the same for the others) + +That way if the user changes notmuch-common-keymap bindings in simple +ways, pick should stay in sync. And if they change them in +complicated ways (say, writing their own notmuch-search wrapper or +something), pick should more or less gracefully de-sync. + +> + ;; Override because we first close message pane and then close pick buffer. +> + (define-key map "q" 'notmuch-pick-quit) +> + ;; Override because we close message pane after the search query is entered. +> + (define-key map "s" 'notmuch-pick-to-search) +> + ;; Override because we want to close message pane first. +> + (define-key map "m" (notmuch-pick-close-message-pane-and #'notmuch-mua-new-mail)) +> + +> (define-key map [mouse-1] 'notmuch-pick-show-message) +> ;; these use notmuch-show functions directly +> (define-key map "|" 'notmuch-show-pipe-message) +> @@ -244,20 +255,16 @@ FUNC." +> (define-key map "e" (notmuch-pick-to-message-pane #'notmuch-pick-button-activate)) +> +> ;; bindings from show (or elsewhere) but we close the message pane first. +> - (define-key map "m" (notmuch-pick-close-message-pane-and #'notmuch-mua-new-mail)) +> (define-key map "f" (notmuch-pick-close-message-pane-and #'notmuch-show-forward-message)) +> (define-key map "r" (notmuch-pick-close-message-pane-and #'notmuch-show-reply-sender)) +> (define-key map "R" (notmuch-pick-close-message-pane-and #'notmuch-show-reply)) +> (define-key map "V" (notmuch-pick-close-message-pane-and #'notmuch-show-view-raw-message)) +> - (define-key map "?" (notmuch-pick-close-message-pane-and #'notmuch-help)) +> +> ;; The main pick bindings +> - (define-key map "q" 'notmuch-pick-quit) +> (define-key map "x" 'notmuch-pick-quit) +> (define-key map "A" 'notmuch-pick-archive-thread) +> (define-key map "a" 'notmuch-pick-archive-message-then-next) +> (define-key map "=" 'notmuch-pick-refresh-view) +> - (define-key map "s" 'notmuch-pick-to-search) +> (define-key map "z" 'notmuch-pick-to-pick) +> (define-key map "n" 'notmuch-pick-next-matching-message) +> (define-key map "p" 'notmuch-pick-prev-matching-message) +> @@ -849,6 +856,7 @@ Complete list of currently available key bindings: +> +> (interactive) +> (kill-all-local-variables) +> + (setq notmuch-buffer-refresh-function #'notmuch-pick-refresh-view) +> (use-local-map notmuch-pick-mode-map) +> (setq major-mode 'notmuch-pick-mode +> mode-name "notmuch-pick")