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 1D917431FCF for ; Tue, 12 Nov 2013 12:18:56 -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 oPLmOAl2Dufm for ; Tue, 12 Nov 2013 12:18:50 -0800 (PST) Received: from mail-wg0-f54.google.com (mail-wg0-f54.google.com [74.125.82.54]) (using TLSv1 with cipher RC4-SHA (128/128 bits)) (No client certificate requested) by olra.theworths.org (Postfix) with ESMTPS id 02317429E31 for ; Tue, 12 Nov 2013 12:18:43 -0800 (PST) Received: by mail-wg0-f54.google.com with SMTP id y10so3049234wgg.9 for ; Tue, 12 Nov 2013 12:18:43 -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=0N5rkZ+LVFKyfSYWkgjwKM8KZWEoiYd5aKylNLATPuU=; b=wM/uqFu1ueFktwYdDEcfh+A+QMFfUwaKxsMMdY3TEIUVSsZkKy96LbnLQ9jklGP80w U5yZCBeSapfHOstU+qHOzCQ8TImCdB0h/hrhXQt92bxZCv5J4NtadEteaOH1GGWbxnb7 v276QQ/qPwt5oskClu8Npg2EojHhpqmknRSRwyF5YcBC/+nQqvjBpnU9RdaZCO4qB48C a7x2sN5NlEvaUqe8rSBoV9YgvuA7fB680K+Xohc3RdNoer+fRxf/7DROTglLFIifksba i+fqbVpo7pMhe4CIpM/FaTvZ36VPtFfjmJX26oa9W8NaAlMmZRf2MLnn+3DNcwbdYv5x vXCg== X-Received: by 10.194.88.225 with SMTP id bj1mr3060539wjb.50.1384287074829; Tue, 12 Nov 2013 12:11:14 -0800 (PST) Received: from localhost (93-97-24-31.zone5.bethere.co.uk. [93.97.24.31]) by mx.google.com with ESMTPSA id qc10sm48003836wic.9.2013.11.12.12.11.14 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Tue, 12 Nov 2013 12:11:14 -0800 (PST) From: Mark Walters To: notmuch@notmuchmail.org Subject: [PATCH v4 6/7] emacs: help: add a special function to deal with remaps Date: Tue, 12 Nov 2013 20:10:58 +0000 Message-Id: <1384287059-3525-7-git-send-email-markwalters1009@gmail.com> X-Mailer: git-send-email 1.7.9.1 In-Reply-To: <1384287059-3525-1-git-send-email-markwalters1009@gmail.com> References: <1384287059-3525-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: Tue, 12 Nov 2013 20:18:56 -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 7b1fc33..33211c8 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