Re: [PATCH v3 0/7] emacs: help: remap keybindings
authorAustin Clements <amdragon@MIT.EDU>
Fri, 8 Nov 2013 20:00:16 +0000 (15:00 +1900)
committerW. Trevor King <wking@tremily.us>
Fri, 7 Nov 2014 17:58:07 +0000 (09:58 -0800)
d0/6296238688be3d23bb0adfb9d4cf5117fe1bf9 [new file with mode: 0644]

diff --git a/d0/6296238688be3d23bb0adfb9d4cf5117fe1bf9 b/d0/6296238688be3d23bb0adfb9d4cf5117fe1bf9
new file mode 100644 (file)
index 0000000..2f7f3b4
--- /dev/null
@@ -0,0 +1,174 @@
+Return-Path: <amdragon@mit.edu>\r
+X-Original-To: notmuch@notmuchmail.org\r
+Delivered-To: notmuch@notmuchmail.org\r
+Received: from localhost (localhost [127.0.0.1])\r
+       by olra.theworths.org (Postfix) with ESMTP id 1895D429E2E\r
+       for <notmuch@notmuchmail.org>; Fri,  8 Nov 2013 12:00:28 -0800 (PST)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: -0.7\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=-0.7 tagged_above=-999 required=5\r
+       tests=[RCVD_IN_DNSWL_LOW=-0.7] autolearn=disabled\r
+Received: from olra.theworths.org ([127.0.0.1])\r
+       by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
+       with ESMTP id m+2bPpDWYvBM for <notmuch@notmuchmail.org>;\r
+       Fri,  8 Nov 2013 12:00:20 -0800 (PST)\r
+Received: from dmz-mailsec-scanner-4.mit.edu (dmz-mailsec-scanner-4.mit.edu\r
+       [18.9.25.15])\r
+       (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits))\r
+       (No client certificate requested)\r
+       by olra.theworths.org (Postfix) with ESMTPS id 94EF4429E35\r
+       for <notmuch@notmuchmail.org>; Fri,  8 Nov 2013 12:00:20 -0800 (PST)\r
+X-AuditID: 1209190f-b7f7b8e0000053dd-5a-527d42d342d3\r
+Received: from mailhub-auth-3.mit.edu ( [18.9.21.43])\r
+       (using TLS with cipher AES256-SHA (256/256 bits))\r
+       (Client did not present a certificate)\r
+       by dmz-mailsec-scanner-4.mit.edu (Symantec Messaging Gateway) with SMTP\r
+       id 6F.70.21469.3D24D725; Fri,  8 Nov 2013 15:00:19 -0500 (EST)\r
+Received: from outgoing.mit.edu (outgoing-auth-1.mit.edu [18.9.28.11])\r
+       by mailhub-auth-3.mit.edu (8.13.8/8.9.2) with ESMTP id rA8K0IHv002993; \r
+       Fri, 8 Nov 2013 15:00:19 -0500\r
+Received: from awakening.csail.mit.edu (awakening.csail.mit.edu [18.26.4.91])\r
+       (authenticated bits=0)\r
+       (User authenticated as amdragon@ATHENA.MIT.EDU)\r
+       by outgoing.mit.edu (8.13.8/8.12.4) with ESMTP id rA8K0GAx022589\r
+       (version=TLSv1/SSLv3 cipher=DHE-RSA-AES128-SHA bits=128 verify=NOT);\r
+       Fri, 8 Nov 2013 15:00:17 -0500\r
+Received: from amthrax by awakening.csail.mit.edu with local (Exim 4.80)\r
+       (envelope-from <amdragon@mit.edu>)\r
+       id 1VesE4-0002xQ-8f; Fri, 08 Nov 2013 15:00:16 -0500\r
+Date: Fri, 8 Nov 2013 15:00:16 -0500\r
+From: Austin Clements <amdragon@MIT.EDU>\r
+To: Mark Walters <markwalters1009@gmail.com>\r
+Subject: Re: [PATCH v3 0/7] emacs: help: remap keybindings\r
+Message-ID: <20131108200016.GN29298@mit.edu>\r
+References: <1383932419-12533-1-git-send-email-markwalters1009@gmail.com>\r
+MIME-Version: 1.0\r
+Content-Type: text/plain; charset=us-ascii\r
+Content-Disposition: inline\r
+In-Reply-To: <1383932419-12533-1-git-send-email-markwalters1009@gmail.com>\r
+User-Agent: Mutt/1.5.21 (2010-09-15)\r
+X-Brightmail-Tracker:\r
+ H4sIAAAAAAAAA+NgFvrHIsWRmVeSWpSXmKPExsUixCmqrXvZqTbI4NUUE4vVc3ksrt+cyezA\r
+       5LFz1l12j2erbjEHMEVx2aSk5mSWpRbp2yVwZexdc5elYLpCxaVfGg2M7ZJdjJwcEgImEiee\r
+       7mSHsMUkLtxbz9bFyMUhJDCbSeLDu4VgCSGBDYwSb5cYQiROMUksWjybHcJZwijRvPEEG0gV\r
+       i4CKxP53y8E62AQ0JLbtX84IYosI6EjcPrQALM4sIC3x7XczUxcjB4ewgJXEnV92IGFeoJKX\r
+       /c+YQcJCAp4SD/ZZQ4QFJU7OfMIC0aklcePfS7BOkCnL/3GAmJwCXhJvrySDVIgC7Z9ychvb\r
+       BEahWUiaZyFpnoXQvICReRWjbEpulW5uYmZOcWqybnFyYl5eapGuiV5uZoleakrpJkZwMEvy\r
+       72D8dlDpEKMAB6MSD+8PjdogIdbEsuLK3EOMkhxMSqK8W62BQnxJ+SmVGYnFGfFFpTmpxYcY\r
+       JTiYlUR4S1WAcrwpiZVVqUX5MClpDhYlcd6bHPZBQgLpiSWp2ampBalFMFkZDg4lCd55jkCN\r
+       gkWp6akVaZk5JQhpJg5OkOE8QMPdQGp4iwsSc4sz0yHypxgVpcR5lYHpQkgAJJFRmgfXC0s2\r
+       rxjFgV4R5v0N0s4DTFRw3a+ABjMBDQ75VQkyuCQRISXVwGgY/bp/eUN5pejBCXPX+kaJvj9c\r
+       VRrkwbDI5XNBv+KqNYY/a4+z3nnk1+l18JrC1qUcyRJZXvwCsT3JfApfpjfWzX7dtHJ5lv+X\r
+       kMtznm76c0hH8pPPpEjGs76nJuUv1f1XtWhZmdsi24kn2eNrL/14/XFiQtuZ97fiAs5eNPzZ\r
+       UPr3oIaD0yolluKMREMt5qLiRADVlghDEQMAAA==\r
+Cc: notmuch@notmuchmail.org\r
+X-BeenThere: notmuch@notmuchmail.org\r
+X-Mailman-Version: 2.1.13\r
+Precedence: list\r
+List-Id: "Use and development of the notmuch mail system."\r
+       <notmuch.notmuchmail.org>\r
+List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
+       <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
+List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
+List-Post: <mailto:notmuch@notmuchmail.org>\r
+List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
+List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
+       <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
+X-List-Received-Date: Fri, 08 Nov 2013 20:00:28 -0000\r
+\r
+LGTM.\r
+\r
+Quoth Mark Walters on Nov 08 at  5:40 pm:\r
+> This is version 3 of the series. v2 is at\r
+> id:1383870096-14627-1-git-send-email-markwalters1009@gmail.com\r
+> \r
+> The changes are in response to Austin's review of v2. I have not\r
+> changed notmuch-describe-key.\r
+> \r
+> The other change is to add a base-keymap to look up the remapped\r
+> commands in (since notmuch-substitute-command-keys could refer to\r
+> something other than the current keymap). Currently this never happens\r
+> but this makes the code more robust.\r
+> \r
+> The final patch of the series is (probably) just for testing\r
+> purposes. It lets you call notmuch-help and specify which mode you\r
+> want to display help for. This means you can call it without having\r
+> the mode as current-mode and hence test the base-keymap code.\r
+> \r
+> Finally the diff from v2 below (with the testing patch omitted) is below.\r
+> \r
+> Best wishes\r
+> \r
+> Mark\r
+> \r
+> diff --git a/emacs/notmuch-lib.el b/emacs/notmuch-lib.el\r
+> index ef616d5..4b3a86e 100644\r
+> --- a/emacs/notmuch-lib.el\r
+> +++ b/emacs/notmuch-lib.el\r
+> @@ -261,7 +261,7 @@ It does not prepend if ACTUAL-KEY is already listed in TAIL."\r
+>          tail)))\r
+>      tail)\r
+>  \r
+> -(defun notmuch-describe-remaps (remap-keymap ua-keys prefix tail)\r
+> +(defun notmuch-describe-remaps (remap-keymap ua-keys base-keymap prefix tail)\r
+>    ;; Remappings are represented as a binding whose first "event" is\r
+>    ;; 'remap.  Hence, if the keymap has any remappings, it will have a\r
+>    ;; binding whose "key" is 'remap, and whose "binding" is itself a\r
+> @@ -272,11 +272,11 @@ It does not prepend if ACTUAL-KEY is already listed in TAIL."\r
+>       (mapc\r
+>        (lambda (actual-key)\r
+>      (setq tail (notmuch-describe-key actual-key binding prefix ua-keys tail)))\r
+> -      (where-is-internal command)))\r
+> +      (where-is-internal command base-keymap)))\r
+>     remap-keymap)\r
+>    tail)\r
+>  \r
+> -(defun notmuch-describe-keymap (keymap ua-keys &optional prefix tail)\r
+> +(defun notmuch-describe-keymap (keymap ua-keys base-keymap &optional prefix tail)\r
+>    "Return a list of cons cells, each describing one binding in KEYMAP.\r
+>  \r
+>  Each cons cell consists of a string giving a human-readable\r
+> @@ -291,13 +291,12 @@ prefix argument.  PREFIX and TAIL are used internally."\r
+>     (lambda (key binding)\r
+>       (cond ((mouse-event-p key) nil)\r
+>         ((keymapp binding)\r
+> -        (if (eq key 'remap)\r
+> -            (setq tail\r
+> +        (setq tail\r
+> +              (if (eq key 'remap)\r
+>                    (notmuch-describe-remaps\r
+> -                   binding ua-keys prefix tail))\r
+> -          (setq tail\r
+> +                   binding ua-keys base-keymap prefix tail)\r
+>                  (notmuch-describe-keymap\r
+> -                 binding ua-keys (notmuch-prefix-key-description key) tail))))\r
+> +                 binding ua-keys base-keymap (notmuch-prefix-key-description key) tail))))\r
+>         (binding\r
+>          (setq tail (notmuch-describe-key (vector key) binding prefix ua-keys tail)))))\r
+>     keymap)\r
+> @@ -310,7 +309,7 @@ prefix argument.  PREFIX and TAIL are used internally."\r
+>        (let* ((keymap-name (substring doc (match-beginning 1) (match-end 1)))\r
+>           (keymap (symbol-value (intern keymap-name)))\r
+>           (ua-keys (where-is-internal 'universal-argument keymap t))\r
+> -         (desc-alist (notmuch-describe-keymap keymap ua-keys))\r
+> +         (desc-alist (notmuch-describe-keymap keymap ua-keys keymap))\r
+>           (desc-list (mapcar (lambda (arg) (concat (car arg) "\t" (cdr arg))) desc-alist))\r
+>           (desc (mapconcat #'identity desc-list "\n")))\r
+>      (setq doc (replace-match desc 1 1 doc)))\r
+> \r
+> \r
+> \r
+> Mark Walters (7):\r
+>   emacs: help: check for nil key binding\r
+>   emacs: help: remove duplicate bindings\r
+>   emacs: help: split out notmuch-describe-key as a function\r
+>   emacs: help: add base-keymap\r
+>   emacs: help: add a special function to deal with remaps\r
+>   emacs: tree: use remap for the over-ridden global bindings\r
+>   emacs: help: base-keymap-test-help\r
+> \r
+>  emacs/notmuch-lib.el  |   79 ++++++++++++++++++++++++++++++++++--------------\r
+>  emacs/notmuch-tree.el |    8 ++--\r
+>  2 files changed, 60 insertions(+), 27 deletions(-)\r