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 6A7CD431FC4 for ; Thu, 7 Nov 2013 19:36:01 -0800 (PST) X-Virus-Scanned: Debian amavisd-new at olra.theworths.org X-Spam-Flag: NO X-Spam-Score: -0.7 X-Spam-Level: X-Spam-Status: No, score=-0.7 tagged_above=-999 required=5 tests=[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 ZmIR81r+OZWw for ; Thu, 7 Nov 2013 19:35:54 -0800 (PST) Received: from dmz-mailsec-scanner-6.mit.edu (dmz-mailsec-scanner-6.mit.edu [18.7.68.35]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by olra.theworths.org (Postfix) with ESMTPS id 6E82A431FC0 for ; Thu, 7 Nov 2013 19:35:54 -0800 (PST) X-AuditID: 12074423-b7fac8e00000539e-76-527c5c1941da Received: from mailhub-auth-4.mit.edu ( [18.7.62.39]) (using TLS with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by dmz-mailsec-scanner-6.mit.edu (Symantec Messaging Gateway) with SMTP id AF.B5.21406.91C5C725; Thu, 7 Nov 2013 22:35:53 -0500 (EST) Received: from outgoing.mit.edu (outgoing-auth-1.mit.edu [18.9.28.11]) by mailhub-auth-4.mit.edu (8.13.8/8.9.2) with ESMTP id rA83ZqLm018781; Thu, 7 Nov 2013 22:35:53 -0500 Received: from awakening.csail.mit.edu (awakening.csail.mit.edu [18.26.4.91]) (authenticated bits=0) (User authenticated as amdragon@ATHENA.MIT.EDU) by outgoing.mit.edu (8.13.8/8.12.4) with ESMTP id rA83ZpaK028005 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES128-SHA bits=128 verify=NOT); Thu, 7 Nov 2013 22:35:52 -0500 Received: from amthrax by awakening.csail.mit.edu with local (Exim 4.80) (envelope-from ) id 1VecrP-0006Ut-3p; Thu, 07 Nov 2013 22:35:51 -0500 Date: Thu, 7 Nov 2013 22:35:51 -0500 From: Austin Clements To: Mark Walters Subject: Re: [PATCH v2 4/5] emacs: help: add a special function to deal with remaps Message-ID: <20131108033551.GM29298@mit.edu> References: <1383870096-14627-1-git-send-email-markwalters1009@gmail.com> <1383870096-14627-5-git-send-email-markwalters1009@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1383870096-14627-5-git-send-email-markwalters1009@gmail.com> User-Agent: Mutt/1.5.21 (2010-09-15) X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFmpmleLIzCtJLcpLzFFi42IRYrdT15WMqQkyOPRW3WL1XB6L6zdnMjsw eeycdZfd49mqW8wBTFFcNimpOZllqUX6dglcGY9uT2Et+CtUsXxddgPjGb4uRk4OCQETiTsH FrBC2GISF+6tZ+ti5OIQEpjNJHGn4zUrhLOBUWLm1l4WCOcUk8SpHZOhypYwSrxZtAusn0VA ReL3nLuMIDabgIbEtv3LwWwRAR2J24cWsIPYzALSEt9+NzOB2MICoRLv5s0Ci/MC1fx5t4Ud Ymgno8S6p+1sEAlBiZMzn7BANGtJ3Pj3EqiZA2zQ8n8cIGFOAS+JMydXgu0SBbphysltbBMY hWYh6Z6FpHsWQvcCRuZVjLIpuVW6uYmZOcWpybrFyYl5ealFumZ6uZkleqkppZsYwWHtoryD 8c9BpUOMAhyMSjy8Jy5VBwmxJpYVV+YeYpTkYFIS5VUKqgkS4kvKT6nMSCzOiC8qzUktPsQo wcGsJML7TBEox5uSWFmVWpQPk5LmYFES573FYR8kJJCeWJKanZpakFoEk5Xh4FCS4H0eBdQo WJSanlqRlplTgpBm4uAEGc4DNPwGSA1vcUFibnFmOkT+FKOilDgvezRQQgAkkVGaB9cLSzuv GMWBXhGGWMEDTFlw3a+ABjMBDQ75VQkyuCQRISXVwGgkHrmiY0OMbt7G+DXvfm/9G3x04n7m FU+uZ9l/75+96DRjde/n96UfjASv3LjJHLWjL/6DvkbE3D0197w+hKgIHWUvSV6RMf/oy6z9 idm/VgRs+SX9YtmGsyUxE83ylldbOO3mmHqlaPppwcnLxWfKWazyuFN0PqWx95ZK5zGrH9PT MpZdWfhKiaU4I9FQi7moOBEAx2mAJxYDAAA= Cc: notmuch@notmuchmail.org 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 03:36:01 -0000 I like the way you separated this out. Quoth Mark Walters on Nov 08 at 12:21 am: > 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) > + Hmm. Maybe holistically the interface change I suggested to the previous patch isn't the right thing to do, since there ends up being a lot of symmetry between these three functions. > (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)))) Maybe swap the if and the setq? (setq tail (if (eq key 'remap) ...)) > (binding > (setq tail (notmuch-describe-key (vector key) binding prefix ua-keys tail))))) > keymap)