From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from localhost (localhost [127.0.0.1]) by olra.theworths.org (Postfix) with ESMTP id 2B120431FD5 for ; Thu, 7 Nov 2013 16:21:59 -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 Q1xN6Fun0BFv for ; Thu, 7 Nov 2013 16:21:52 -0800 (PST) Received: from mail-wi0-f173.google.com (mail-wi0-f173.google.com [209.85.212.173]) (using TLSv1 with cipher RC4-SHA (128/128 bits)) (No client certificate requested) by olra.theworths.org (Postfix) with ESMTPS id EAED5429E26 for ; Thu, 7 Nov 2013 16:21:48 -0800 (PST) Received: by mail-wi0-f173.google.com with SMTP id ey11so1463352wid.6 for ; Thu, 07 Nov 2013 16:21:47 -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=sZ3hwWKZN/N7y2tPCK/yGUBmqveotHFfrlm4tHPq5Mc=; b=BaXB07YGL56WhaoPaB48Ckvtr78WYrUE7LMjhBJbVMZ/qiTFMF7gF3AwwJpQneLfIo 3wPK+9T+RUTjw7zBahFtFZJzJcmmHU30Y/lwCQZbe4kf4AiAg1UV1xTSkbpf5bhdigfA KpzmwiW/ff1a6H5UYsFrD1IRGmlq49Nfqfi4BgJZsbnFgAEOL33S2DigRBkelsmq6YTH tpPY6kp55o10i18Rhs6VWi4jkzRfXcnJNKVfu06zCboae4h/TFOcrhXCDbcw/e69M2oa mWKaRQmlJqE3O93TCL4LDl0qEu5SgPGvxzLBpea9sa/nV/ONPnDBn/z/sCWZOopVlDKs luRQ== X-Received: by 10.180.184.14 with SMTP id eq14mr118594wic.56.1383870107813; Thu, 07 Nov 2013 16:21:47 -0800 (PST) Received: from localhost (93-97-24-31.zone5.bethere.co.uk. [93.97.24.31]) by mx.google.com with ESMTPSA id qc10sm385278wic.9.2013.11.07.16.21.47 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Thu, 07 Nov 2013 16:21:47 -0800 (PST) From: Mark Walters To: notmuch@notmuchmail.org Subject: [PATCH v2 4/5] emacs: help: add a special function to deal with remaps Date: Fri, 8 Nov 2013 00:21:35 +0000 Message-Id: <1383870096-14627-5-git-send-email-markwalters1009@gmail.com> X-Mailer: git-send-email 1.7.9.1 In-Reply-To: <1383870096-14627-1-git-send-email-markwalters1009@gmail.com> References: <1383870096-14627-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 00:21:59 -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 | 25 ++++++++++++++++++++++--- 1 files changed, 22 insertions(+), 3 deletions(-) diff --git a/emacs/notmuch-lib.el b/emacs/notmuch-lib.el index 8852703..ef616d5 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 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))) + remap-keymap) + tail) + (defun notmuch-describe-keymap (keymap ua-keys &optional prefix tail) "Return a list of cons cells, each describing one binding in KEYMAP. @@ -276,9 +291,13 @@ prefix argument. PREFIX and TAIL are used internally." (lambda (key binding) (cond ((mouse-event-p key) nil) ((keymapp binding) - (setq tail - (notmuch-describe-keymap - binding ua-keys (notmuch-prefix-key-description key) tail))) + (if (eq key 'remap) + (setq tail + (notmuch-describe-remaps + binding ua-keys prefix tail)) + (setq tail + (notmuch-describe-keymap + binding ua-keys (notmuch-prefix-key-description key) tail)))) (binding (setq tail (notmuch-describe-key (vector key) binding prefix ua-keys tail))))) keymap) -- 1.7.9.1