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 C991D431FD0 for ; Fri, 30 Dec 2011 03:37:23 -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 lmUb7pWXqBvd for ; Fri, 30 Dec 2011 03:37:23 -0800 (PST) Received: from mail-wi0-f181.google.com (mail-wi0-f181.google.com [209.85.212.181]) (using TLSv1 with cipher RC4-SHA (128/128 bits)) (No client certificate requested) by olra.theworths.org (Postfix) with ESMTPS id 2B0E0431FB6 for ; Fri, 30 Dec 2011 03:37:23 -0800 (PST) Received: by wibhq2 with SMTP id hq2so8207372wib.26 for ; Fri, 30 Dec 2011 03:37:22 -0800 (PST) Received: by 10.180.19.138 with SMTP id f10mr107965975wie.3.1325245042064; Fri, 30 Dec 2011 03:37:22 -0800 (PST) Received: from hotblack-desiato.hh.sledj.net (host81-149-164-25.in-addr.btopenworld.com. [81.149.164.25]) by mx.google.com with ESMTPS id em4sm39222262wbb.20.2011.12.30.03.37.20 (version=TLSv1/SSLv3 cipher=OTHER); Fri, 30 Dec 2011 03:37:21 -0800 (PST) Received: by hotblack-desiato.hh.sledj.net (Postfix, from userid 30000) id D62B8A04DF; Fri, 30 Dec 2011 11:37:18 +0000 (GMT) From: David Edmondson To: notmuch@notmuchmail.org Subject: [PATCH] emacs: Better handling of inherited keymaps for `nomuch-help'. Date: Fri, 30 Dec 2011 11:37:17 +0000 Message-Id: <1325245037-32680-1-git-send-email-dme@dme.org> X-Mailer: git-send-email 1.7.7.3 In-Reply-To: <87ei522v4t.fsf@A7GMS.i-did-not-set--mail-host-address--so-tickle-me> References: <87ei522v4t.fsf@A7GMS.i-did-not-set--mail-host-address--so-tickle-me> 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, 30 Dec 2011 11:37:23 -0000 `notmuch-hello-mode' inherits the keymap for widgets, which confused `notmuch-substitute-command-keys'. Fix the confusion. Simplify `notmuch-substitute-command-keys' a little to make it easier to read. --- emacs/notmuch.el | 17 ++++++++++++----- 1 files changed, 12 insertions(+), 5 deletions(-) diff --git a/emacs/notmuch.el b/emacs/notmuch.el index fde2377..6dd65ff 100644 --- a/emacs/notmuch.el +++ b/emacs/notmuch.el @@ -164,16 +164,23 @@ For a mouse binding, return nil." "\t" (notmuch-documentation-first-line action)))))) -(defalias 'notmuch-substitute-one-command-key - (apply-partially 'notmuch-substitute-one-command-key-with-prefix nil)) +(defun notmuch-substitute-command-keys-one (key) + ;; A `keymap' key indicates inheritance from a parent keymap - the + ;; inherited mappings follow, so there is nothing to print for + ;; `keymap' itself. + (when (not (eq key 'keymap)) + (notmuch-substitute-one-command-key-with-prefix nil key))) (defun notmuch-substitute-command-keys (doc) "Like `substitute-command-keys' but with documentation, not function names." (let ((beg 0)) (while (string-match "\\\\{\\([^}[:space:]]*\\)}" doc beg) - (let ((map (substring doc (match-beginning 1) (match-end 1)))) - (setq doc (replace-match (mapconcat 'notmuch-substitute-one-command-key - (cdr (symbol-value (intern map))) "\n") 1 1 doc))) + (let* ((keymap-name (substring doc (match-beginning 1) (match-end 1))) + (keymap (symbol-value (intern keymap-name)))) + (setq doc (replace-match + (mapconcat #'notmuch-substitute-command-keys-one + (cdr keymap) "\n") + 1 1 doc))) (setq beg (match-end 0))) doc)) -- 1.7.7.3