From ebec15646cea2fa7fbaeed3eda3ca5875b492dc2 Mon Sep 17 00:00:00 2001 From: Mark Walters Date: Fri, 8 Nov 2013 17:40:17 +0000 Subject: [PATCH] [PATCH v3 5/7] emacs: help: add a special function to deal with remaps --- 8e/f7a2cdf659a1ccabf9c8380b5b5111afcc4961 | 114 ++++++++++++++++++++++ 1 file changed, 114 insertions(+) create mode 100644 8e/f7a2cdf659a1ccabf9c8380b5b5111afcc4961 diff --git a/8e/f7a2cdf659a1ccabf9c8380b5b5111afcc4961 b/8e/f7a2cdf659a1ccabf9c8380b5b5111afcc4961 new file mode 100644 index 000000000..4ab77abaf --- /dev/null +++ b/8e/f7a2cdf659a1ccabf9c8380b5b5111afcc4961 @@ -0,0 +1,114 @@ +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 55BCE421161 + for ; Fri, 8 Nov 2013 09:40:47 -0800 (PST) +X-Virus-Scanned: Debian amavisd-new at olra.theworths.org +X-Spam-Flag: NO +X-Spam-Score: 0.201 +X-Spam-Level: +X-Spam-Status: No, score=0.201 tagged_above=-999 required=5 + tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, + FREEMAIL_ENVFROM_END_DIGIT=1, FREEMAIL_FROM=0.001, + 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 bXtz0wkIqxGg for ; + Fri, 8 Nov 2013 09:40:41 -0800 (PST) +Received: from mail-we0-f174.google.com (mail-we0-f174.google.com + [74.125.82.174]) (using TLSv1 with cipher RC4-SHA (128/128 bits)) + (No client certificate requested) + by olra.theworths.org (Postfix) with ESMTPS id 8397A429E28 + for ; Fri, 8 Nov 2013 09:40:32 -0800 (PST) +Received: by mail-we0-f174.google.com with SMTP id p61so2271091wes.19 + for ; Fri, 08 Nov 2013 09:40:31 -0800 (PST) +DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; + h=from:to:cc:subject:date:message-id:in-reply-to:references; + bh=CZpEYw4ni+J0l9LmGehEJtzpuV7m3J6oqoO4RMRsLYM=; + b=RuYXoHauWA4kWE47K15TbUGDYANtjTDY723L/66Rk9TA9WRTThPOgZx4+defTAz5Y+ + jN2SChJKEM2TowkGf3lBbAbIr+ENL4aoHqOknmnRSlpu5GpYqU8BKRlB14h3pSVHqj9g + q4RpIqp8ydNAmSkaA3hmAZO3SpZytBuxTnf9cltv/jCuejtczkM9M3JOZ5fA8pdL1QrN + 7VK01dtY+Tc8M9BhISbdj2u43qOI4QC9sJ/z2r7GVd20B2c88zb1v3NhKuV9+43Muzh4 + 1mSlQJ8VL+Ii6xkVyJPCkicvN2jlQQlwLh9j01ctjMeiXqVFjMr5RoLAelHKg+URanuQ + 7GRg== +X-Received: by 10.180.208.49 with SMTP id mb17mr3302365wic.64.1383932431558; + Fri, 08 Nov 2013 09:40:31 -0800 (PST) +Received: from localhost (93-97-24-31.zone5.bethere.co.uk. [93.97.24.31]) + by mx.google.com with ESMTPSA id c10sm7507567wie.11.2013.11.08.09.40.30 + for + (version=TLSv1.2 cipher=RC4-SHA bits=128/128); + Fri, 08 Nov 2013 09:40:31 -0800 (PST) +From: Mark Walters +To: notmuch@notmuchmail.org +Subject: [PATCH v3 5/7] emacs: help: add a special function to deal with + remaps +Date: Fri, 8 Nov 2013 17:40:17 +0000 +Message-Id: <1383932419-12533-6-git-send-email-markwalters1009@gmail.com> +X-Mailer: git-send-email 1.7.9.1 +In-Reply-To: <1383932419-12533-1-git-send-email-markwalters1009@gmail.com> +References: <1383932419-12533-1-git-send-email-markwalters1009@gmail.com> +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: Fri, 08 Nov 2013 17:40:47 -0000 + +remaps are a rather unusual keymap consisting of "first key" 'remap +and then "second-key" the remapped-function. Thus we do the +documentation for it separately. +--- + emacs/notmuch-lib.el | 22 ++++++++++++++++++++-- + 1 files changed, 20 insertions(+), 2 deletions(-) + +diff --git a/emacs/notmuch-lib.el b/emacs/notmuch-lib.el +index a4f481b..4b3a86e 100644 +--- a/emacs/notmuch-lib.el ++++ b/emacs/notmuch-lib.el +@@ -261,6 +261,21 @@ It does not prepend if ACTUAL-KEY is already listed in TAIL." + tail))) + tail) + ++(defun notmuch-describe-remaps (remap-keymap ua-keys base-keymap prefix tail) ++ ;; Remappings are represented as a binding whose first "event" is ++ ;; 'remap. Hence, if the keymap has any remappings, it will have a ++ ;; binding whose "key" is 'remap, and whose "binding" is itself a ++ ;; keymap that maps not from keys to commands, but from old (remapped) ++ ;; functions to the commands to use in their stead. ++ (map-keymap ++ (lambda (command binding) ++ (mapc ++ (lambda (actual-key) ++ (setq tail (notmuch-describe-key actual-key binding prefix ua-keys tail))) ++ (where-is-internal command base-keymap))) ++ remap-keymap) ++ tail) ++ + (defun notmuch-describe-keymap (keymap ua-keys base-keymap &optional prefix tail) + "Return a list of cons cells, each describing one binding in KEYMAP. + +@@ -277,8 +292,11 @@ prefix argument. PREFIX and TAIL are used internally." + (cond ((mouse-event-p key) nil) + ((keymapp binding) + (setq tail +- (notmuch-describe-keymap +- binding ua-keys base-keymap (notmuch-prefix-key-description key) tail))) ++ (if (eq key 'remap) ++ (notmuch-describe-remaps ++ binding ua-keys base-keymap prefix tail) ++ (notmuch-describe-keymap ++ binding ua-keys base-keymap (notmuch-prefix-key-description key) tail)))) + (binding + (setq tail (notmuch-describe-key (vector key) binding prefix ua-keys tail))))) + keymap) +-- +1.7.9.1 + -- 2.26.2