[PATCH 3/4] emacs: help: remap support
authorMark Walters <markwalters1009@gmail.com>
Sat, 26 Oct 2013 21:04:38 +0000 (22:04 +0100)
committerW. Trevor King <wking@tremily.us>
Fri, 7 Nov 2014 17:57:39 +0000 (09:57 -0800)
2c/c6d73e5ffb9ce68ff1e5a85d8a9a732ee1bf9a [new file with mode: 0644]

diff --git a/2c/c6d73e5ffb9ce68ff1e5a85d8a9a732ee1bf9a b/2c/c6d73e5ffb9ce68ff1e5a85d8a9a732ee1bf9a
new file mode 100644 (file)
index 0000000..20612ac
--- /dev/null
@@ -0,0 +1,124 @@
+Return-Path: <markwalters1009@gmail.com>\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 0AC34429E47\r
+       for <notmuch@notmuchmail.org>; Sat, 26 Oct 2013 14:04:59 -0700 (PDT)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: 0.201\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=0.201 tagged_above=-999 required=5\r
+       tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1,\r
+       FREEMAIL_ENVFROM_END_DIGIT=1, FREEMAIL_FROM=0.001,\r
+       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 2Ueqlnf5q7DZ for <notmuch@notmuchmail.org>;\r
+       Sat, 26 Oct 2013 14:04:54 -0700 (PDT)\r
+Received: from mail-wi0-f182.google.com (mail-wi0-f182.google.com\r
+       [209.85.212.182]) (using TLSv1 with cipher RC4-SHA (128/128 bits))\r
+       (No client certificate requested)\r
+       by olra.theworths.org (Postfix) with ESMTPS id 5034E429E4B\r
+       for <notmuch@notmuchmail.org>; Sat, 26 Oct 2013 14:04:49 -0700 (PDT)\r
+Received: by mail-wi0-f182.google.com with SMTP id ez12so2482775wid.3\r
+       for <notmuch@notmuchmail.org>; Sat, 26 Oct 2013 14:04:48 -0700 (PDT)\r
+DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113;\r
+       h=from:to:cc:subject:date:message-id:in-reply-to:references;\r
+       bh=nPY1vstdys9cQ2wFwQ6SmXBiVMe7Zc1+BfN5Iy4s74g=;\r
+       b=po3xijRtHzVECOgYTIWH8DRadD+4vX+ovjMj4i/czFofP2AJdrqbEmXzOc0bCMhP+8\r
+       FAbpvA2rK3/fwWwH70SejE0uvjmSqQY1W6FjjNTk/v4SBqGHk5+xZjeBR4jcQyYz+fb5\r
+       WRMX1laObTWKfgq9716Gyig3M3/HFWdYJVuJSnoOMPNDq1jzgW5ZYp/bJ3njq7uzcy2Z\r
+       yPU69dzg02O6yGyu46RenbEbuWe5oGXwoYcv4vGXXfrwYfCCnGsxjEjzXyLQeAldttCp\r
+       eew84FsGbWi3wfyV3INr6BDEmCVSxPpqBn9QryvnVWvW2YwEkykD+4d44HVB/+K3PtQq\r
+       jzqA==\r
+X-Received: by 10.194.239.40 with SMTP id vp8mr12583449wjc.45.1382821488193;\r
+       Sat, 26 Oct 2013 14:04:48 -0700 (PDT)\r
+Received: from localhost (93-97-24-31.zone5.bethere.co.uk. [93.97.24.31])\r
+       by mx.google.com with ESMTPSA id\r
+       ey4sm19610558wic.11.2013.10.26.14.04.47 for <multiple recipients>\r
+       (version=TLSv1.2 cipher=RC4-SHA bits=128/128);\r
+       Sat, 26 Oct 2013 14:04:47 -0700 (PDT)\r
+From: Mark Walters <markwalters1009@gmail.com>\r
+To: notmuch@notmuchmail.org\r
+Subject: [PATCH 3/4] emacs: help: remap support\r
+Date: Sat, 26 Oct 2013 22:04:38 +0100\r
+Message-Id: <1382821479-23384-4-git-send-email-markwalters1009@gmail.com>\r
+X-Mailer: git-send-email 1.7.9.1\r
+In-Reply-To: <1382821479-23384-1-git-send-email-markwalters1009@gmail.com>\r
+References: <1382821479-23384-1-git-send-email-markwalters1009@gmail.com>\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: Sat, 26 Oct 2013 21:04:59 -0000\r
+\r
+If a user or mode uses remap to rebind a keybinding then it appears in\r
+the help as a line <remap><function> New function docstring. Special\r
+case these remapping lines so that we print the actual binding.\r
+---\r
+ emacs/notmuch.el |   21 ++++++++++++++-------\r
+ 1 files changed, 14 insertions(+), 7 deletions(-)\r
+\r
+diff --git a/emacs/notmuch.el b/emacs/notmuch.el\r
+index b9db9ba..c354b05 100644\r
+--- a/emacs/notmuch.el\r
++++ b/emacs/notmuch.el\r
+@@ -140,7 +140,7 @@ This is basically just `format-kbd-macro' but we also convert ESC to M-."\r
+       "M-"\r
+       (concat desc " "))))\r
\r
+-(defun notmuch-describe-keymap (keymap ua-keys &optional prefix tail)\r
++(defun notmuch-describe-keymap (keymap ua-keys &optional prefix tail remap)\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
+@@ -150,16 +150,23 @@ documentation is extracted.\r
\r
+ UA-KEYS should be a key sequence bound to `universal-argument'.\r
+ It will be used to describe bindings of commands that support a\r
+-prefix argument.  PREFIX and TAIL are used internally."\r
++prefix argument.  PREFIX, TAIL and REMAP are used internally."\r
+   (map-keymap\r
+    (lambda (key binding)\r
+      (cond ((mouse-event-p key) nil)\r
+          ((keymapp binding)\r
+-          (setq tail\r
+-                (notmuch-describe-keymap\r
+-                 binding ua-keys (notmuch-prefix-key-description key) tail)))\r
++          (if (equal key 'remap)\r
++              (setq tail\r
++                    (notmuch-describe-keymap\r
++                     binding ua-keys prefix tail t))\r
++            (setq tail\r
++                  (notmuch-describe-keymap\r
++                   binding ua-keys (notmuch-prefix-key-description key) tail))))\r
+          (t\r
+-          (let ((key-string (concat prefix (format-kbd-macro (vector key)))))\r
++          (let* ((actual-key (if remap\r
++                                 (where-is-internal key nil t)\r
++                               (vector key)))\r
++                 (key-string (concat prefix (format-kbd-macro actual-key))))\r
+             ;; We don't include documentation if the key-binding is\r
+             ;; over-ridden. Note, over-riding a binding\r
+             ;; automatically hides the prefixed version too.\r
+@@ -168,7 +175,7 @@ prefix argument.  PREFIX and TAIL are used internally."\r
+                          (get binding 'notmuch-prefix-doc))\r
+                 ;; Documentation for prefixed command\r
+                 (let ((ua-desc (key-description ua-keys)))\r
+-                  (push (cons (concat ua-desc " " prefix (format-kbd-macro (vector key)))\r
++                  (push (cons (concat ua-desc " " prefix (format-kbd-macro actual-key))\r
+                               (get binding 'notmuch-prefix-doc))\r
+                         tail)))\r
+               ;; Documentation for command\r
+-- \r
+1.7.9.1\r
+\r