[PATCH v3 5/7] emacs: help: add a special function to deal with remaps
authorMark Walters <markwalters1009@gmail.com>
Fri, 8 Nov 2013 17:40:17 +0000 (17:40 +0000)
committerW. Trevor King <wking@tremily.us>
Fri, 7 Nov 2014 17:58:06 +0000 (09:58 -0800)
8e/f7a2cdf659a1ccabf9c8380b5b5111afcc4961 [new file with mode: 0644]

diff --git a/8e/f7a2cdf659a1ccabf9c8380b5b5111afcc4961 b/8e/f7a2cdf659a1ccabf9c8380b5b5111afcc4961
new file mode 100644 (file)
index 0000000..4ab77ab
--- /dev/null
@@ -0,0 +1,114 @@
+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 55BCE421161\r
+       for <notmuch@notmuchmail.org>; Fri,  8 Nov 2013 09:40:47 -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 bXtz0wkIqxGg for <notmuch@notmuchmail.org>;\r
+       Fri,  8 Nov 2013 09:40:41 -0800 (PST)\r
+Received: from mail-we0-f174.google.com (mail-we0-f174.google.com\r
+       [74.125.82.174]) (using TLSv1 with cipher RC4-SHA (128/128 bits))\r
+       (No client certificate requested)\r
+       by olra.theworths.org (Postfix) with ESMTPS id 8397A429E28\r
+       for <notmuch@notmuchmail.org>; Fri,  8 Nov 2013 09:40:32 -0800 (PST)\r
+Received: by mail-we0-f174.google.com with SMTP id p61so2271091wes.19\r
+       for <notmuch@notmuchmail.org>; Fri, 08 Nov 2013 09:40:31 -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=CZpEYw4ni+J0l9LmGehEJtzpuV7m3J6oqoO4RMRsLYM=;\r
+       b=RuYXoHauWA4kWE47K15TbUGDYANtjTDY723L/66Rk9TA9WRTThPOgZx4+defTAz5Y+\r
+       jN2SChJKEM2TowkGf3lBbAbIr+ENL4aoHqOknmnRSlpu5GpYqU8BKRlB14h3pSVHqj9g\r
+       q4RpIqp8ydNAmSkaA3hmAZO3SpZytBuxTnf9cltv/jCuejtczkM9M3JOZ5fA8pdL1QrN\r
+       7VK01dtY+Tc8M9BhISbdj2u43qOI4QC9sJ/z2r7GVd20B2c88zb1v3NhKuV9+43Muzh4\r
+       1mSlQJ8VL+Ii6xkVyJPCkicvN2jlQQlwLh9j01ctjMeiXqVFjMr5RoLAelHKg+URanuQ\r
+       7GRg==\r
+X-Received: by 10.180.208.49 with SMTP id mb17mr3302365wic.64.1383932431558;\r
+       Fri, 08 Nov 2013 09:40:31 -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 c10sm7507567wie.11.2013.11.08.09.40.30\r
+       for <multiple recipients>\r
+       (version=TLSv1.2 cipher=RC4-SHA bits=128/128);\r
+       Fri, 08 Nov 2013 09:40:31 -0800 (PST)\r
+From: Mark Walters <markwalters1009@gmail.com>\r
+To: notmuch@notmuchmail.org\r
+Subject: [PATCH v3 5/7] emacs: help: add a special function to deal with\r
+ remaps\r
+Date: Fri,  8 Nov 2013 17:40:17 +0000\r
+Message-Id: <1383932419-12533-6-git-send-email-markwalters1009@gmail.com>\r
+X-Mailer: git-send-email 1.7.9.1\r
+In-Reply-To: <1383932419-12533-1-git-send-email-markwalters1009@gmail.com>\r
+References: <1383932419-12533-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 17:40:47 -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 |   22 ++++++++++++++++++++--\r
+ 1 files changed, 20 insertions(+), 2 deletions(-)\r
+\r
+diff --git a/emacs/notmuch-lib.el b/emacs/notmuch-lib.el\r
+index a4f481b..4b3a86e 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 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
++  ;; 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 base-keymap)))\r
++   remap-keymap)\r
++  tail)\r
++\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
+@@ -277,8 +292,11 @@ prefix argument.  PREFIX and TAIL are used internally."\r
+      (cond ((mouse-event-p key) nil)\r
+          ((keymapp binding)\r
+           (setq tail\r
+-                (notmuch-describe-keymap\r
+-                 binding ua-keys base-keymap (notmuch-prefix-key-description key) tail)))\r
++                (if (eq key 'remap)\r
++                    (notmuch-describe-remaps\r
++                     binding ua-keys base-keymap prefix tail)\r
++                  (notmuch-describe-keymap\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
+-- \r
+1.7.9.1\r
+\r