[PATCH v2 4/5] emacs: help: add a special function to deal with remaps
authorMark Walters <markwalters1009@gmail.com>
Fri, 8 Nov 2013 00:21:35 +0000 (00:21 +0000)
committerW. Trevor King <wking@tremily.us>
Fri, 7 Nov 2014 17:58:05 +0000 (09:58 -0800)
e6/2415143e6cf3e31ad2b912af6d3f0102a56f7c [new file with mode: 0644]

diff --git a/e6/2415143e6cf3e31ad2b912af6d3f0102a56f7c b/e6/2415143e6cf3e31ad2b912af6d3f0102a56f7c
new file mode 100644 (file)
index 0000000..15a664b
--- /dev/null
@@ -0,0 +1,117 @@
+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 2B120431FD5\r
+       for <notmuch@notmuchmail.org>; Thu,  7 Nov 2013 16:21:59 -0800 (PST)\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 Q1xN6Fun0BFv for <notmuch@notmuchmail.org>;\r
+       Thu,  7 Nov 2013 16:21:52 -0800 (PST)\r
+Received: from mail-wi0-f173.google.com (mail-wi0-f173.google.com\r
+       [209.85.212.173]) (using TLSv1 with cipher RC4-SHA (128/128 bits))\r
+       (No client certificate requested)\r
+       by olra.theworths.org (Postfix) with ESMTPS id EAED5429E26\r
+       for <notmuch@notmuchmail.org>; Thu,  7 Nov 2013 16:21:48 -0800 (PST)\r
+Received: by mail-wi0-f173.google.com with SMTP id ey11so1463352wid.6\r
+       for <notmuch@notmuchmail.org>; Thu, 07 Nov 2013 16:21:47 -0800 (PST)\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=sZ3hwWKZN/N7y2tPCK/yGUBmqveotHFfrlm4tHPq5Mc=;\r
+       b=BaXB07YGL56WhaoPaB48Ckvtr78WYrUE7LMjhBJbVMZ/qiTFMF7gF3AwwJpQneLfIo\r
+       3wPK+9T+RUTjw7zBahFtFZJzJcmmHU30Y/lwCQZbe4kf4AiAg1UV1xTSkbpf5bhdigfA\r
+       KpzmwiW/ff1a6H5UYsFrD1IRGmlq49Nfqfi4BgJZsbnFgAEOL33S2DigRBkelsmq6YTH\r
+       tpPY6kp55o10i18Rhs6VWi4jkzRfXcnJNKVfu06zCboae4h/TFOcrhXCDbcw/e69M2oa\r
+       mWKaRQmlJqE3O93TCL4LDl0qEu5SgPGvxzLBpea9sa/nV/ONPnDBn/z/sCWZOopVlDKs\r
+       luRQ==\r
+X-Received: by 10.180.184.14 with SMTP id eq14mr118594wic.56.1383870107813;\r
+       Thu, 07 Nov 2013 16:21:47 -0800 (PST)\r
+Received: from localhost (93-97-24-31.zone5.bethere.co.uk. [93.97.24.31])\r
+       by mx.google.com with ESMTPSA id qc10sm385278wic.9.2013.11.07.16.21.47\r
+       for <multiple recipients>\r
+       (version=TLSv1.2 cipher=RC4-SHA bits=128/128);\r
+       Thu, 07 Nov 2013 16:21:47 -0800 (PST)\r
+From: Mark Walters <markwalters1009@gmail.com>\r
+To: notmuch@notmuchmail.org\r
+Subject: [PATCH v2 4/5] emacs: help: add a special function to deal with\r
+ remaps\r
+Date: Fri,  8 Nov 2013 00:21:35 +0000\r
+Message-Id: <1383870096-14627-5-git-send-email-markwalters1009@gmail.com>\r
+X-Mailer: git-send-email 1.7.9.1\r
+In-Reply-To: <1383870096-14627-1-git-send-email-markwalters1009@gmail.com>\r
+References: <1383870096-14627-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: Fri, 08 Nov 2013 00:21:59 -0000\r
+\r
+remaps are a rather unusual keymap consisting of "first key" 'remap\r
+and then "second-key" the remapped-function. Thus we do the\r
+documentation for it separately.\r
+---\r
+ emacs/notmuch-lib.el |   25 ++++++++++++++++++++++---\r
+ 1 files changed, 22 insertions(+), 3 deletions(-)\r
+\r
+diff --git a/emacs/notmuch-lib.el b/emacs/notmuch-lib.el\r
+index 8852703..ef616d5 100644\r
+--- a/emacs/notmuch-lib.el\r
++++ b/emacs/notmuch-lib.el\r
+@@ -261,6 +261,21 @@ 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
++  ;; 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
++  ;; keymap that maps not from keys to commands, but from old (remapped)\r
++  ;; functions to the commands to use in their stead.\r
++  (map-keymap\r
++   (lambda (command binding)\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
++   remap-keymap)\r
++  tail)\r
++\r
+ (defun notmuch-describe-keymap (keymap ua-keys &optional prefix tail)\r
+   "Return a list of cons cells, each describing one binding in KEYMAP.\r
\r
+@@ -276,9 +291,13 @@ prefix argument.  PREFIX and TAIL are used internally."\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 (eq key 'remap)\r
++              (setq tail\r
++                    (notmuch-describe-remaps\r
++                     binding ua-keys prefix tail))\r
++            (setq tail\r
++                  (notmuch-describe-keymap\r
++                   binding ua-keys (notmuch-prefix-key-description key) tail))))\r
+          (binding\r
+           (setq tail (notmuch-describe-key (vector key) binding prefix ua-keys tail)))))\r
+    keymap)\r
+-- \r
+1.7.9.1\r
+\r