From ee77487dc697df5f205bb1a379dca72a9705028e Mon Sep 17 00:00:00 2001 From: Mark Walters Date: Fri, 11 Oct 2013 14:39:54 +0100 Subject: [PATCH] [PATCH 1/1] emacs: don't show duplicate keys in help. --- 34/df63795f2b3bab1a17626bd5541ac58d753cfd | 130 ++++++++++++++++++++++ 1 file changed, 130 insertions(+) create mode 100644 34/df63795f2b3bab1a17626bd5541ac58d753cfd diff --git a/34/df63795f2b3bab1a17626bd5541ac58d753cfd b/34/df63795f2b3bab1a17626bd5541ac58d753cfd new file mode 100644 index 000000000..557d40a86 --- /dev/null +++ b/34/df63795f2b3bab1a17626bd5541ac58d753cfd @@ -0,0 +1,130 @@ +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 307DA431FAE + for ; Fri, 11 Oct 2013 06:40:08 -0700 (PDT) +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 6tMpiLV-KfPk for ; + Fri, 11 Oct 2013 06:40:02 -0700 (PDT) +Received: from mail-wg0-f51.google.com (mail-wg0-f51.google.com + [74.125.82.51]) (using TLSv1 with cipher RC4-SHA (128/128 bits)) (No client + certificate requested) by olra.theworths.org (Postfix) with ESMTPS id + 8502B431FAF for ; Fri, 11 Oct 2013 06:40:02 -0700 + (PDT) +Received: by mail-wg0-f51.google.com with SMTP id l18so443822wgh.30 + for ; Fri, 11 Oct 2013 06:40:00 -0700 (PDT) +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=IVwzimEJLqmJCzEd5go0ZUoy5BK9BMGw5j1TJOlx+Vs=; + b=Q0QSfoCK3nc13lOd1Wm9p7eovHRL6z+2w0oheyaKl69if7g1mKXidGzrF9+O+LHxUf + t2jZ6jTIUEh5QKAUcZOSoNdWfMKv3+wruwKFbrayEkGHQyKqjlrzIw0kcN5WKcLp+lF1 + XNSEAWBfhau9/UCw66PkdSrmpnu8OZwGeVJGpku5VPRVQHSJPv0FnnOYznpx9s/afoIY + dBBpWpoVxkCceWLdaMNUJ6bExz3Ku9RBEF4AcOn9p91FP5wdyCUd4VQLuTf2fon0WrNy + 4CyQOqKzdl3qFV+w8gmdLm+sSvkf49nBM/XU86Z6vdFiw/Bst8gSV56rIFRIwQwRQuOR + 65yQ== +X-Received: by 10.194.104.42 with SMTP id gb10mr17351416wjb.16.1381498799996; + Fri, 11 Oct 2013 06:39:59 -0700 (PDT) +Received: from localhost (93-97-24-31.zone5.bethere.co.uk. [93.97.24.31]) + by mx.google.com with ESMTPSA id b7sm5823085wiz.8.1969.12.31.16.00.00 + (version=TLSv1.2 cipher=RC4-SHA bits=128/128); + Fri, 11 Oct 2013 06:39:59 -0700 (PDT) +From: Mark Walters +To: notmuch@notmuchmail.org +Subject: [PATCH 1/1] emacs: don't show duplicate keys in help. +Date: Fri, 11 Oct 2013 14:39:54 +0100 +Message-Id: <1381498794-17000-2-git-send-email-markwalters1009@gmail.com> +X-Mailer: git-send-email 1.7.9.1 +In-Reply-To: <1381498794-17000-1-git-send-email-markwalters1009@gmail.com> +References: <1381498794-17000-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, 11 Oct 2013 13:40:08 -0000 + +Previously notmuch-help would show two entries for keys in a parent +keymap that were over-ridden in the local keymap. This keeps track of +which keys have been seen and thus avoids these spurious duplicate +entries. + +--- + emacs/notmuch.el | 45 ++++++++++++++++++++++++--------------------- + 1 files changed, 24 insertions(+), 21 deletions(-) + +diff --git a/emacs/notmuch.el b/emacs/notmuch.el +index c47c6b5..4f4e2e7 100644 +--- a/emacs/notmuch.el ++++ b/emacs/notmuch.el +@@ -150,27 +150,30 @@ for an overview of how this documentation is extracted. + UA-KEYS should be a key sequence bound to `universal-argument'. + It will be used to describe bindings of commands that support a + prefix argument. PREFIX and TAIL are used internally." +- (map-keymap +- (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))) +- (t +- (when (and ua-keys (symbolp binding) +- (get binding 'notmuch-prefix-doc)) +- ;; Documentation for prefixed command +- (let ((ua-desc (key-description ua-keys))) +- (push (concat ua-desc " " prefix (format-kbd-macro (vector key)) +- "\t" (get binding 'notmuch-prefix-doc)) +- tail))) +- ;; Documentation for command +- (push (concat prefix (format-kbd-macro (vector key)) "\t" +- (or (and (symbolp binding) (get binding 'notmuch-doc)) +- (notmuch-documentation-first-line binding))) +- tail)))) +- keymap) ++ (let (keys-seen) ++ (map-keymap ++ (lambda (key binding) ++ (unless (memq key keys-seen) ++ (push key keys-seen) ++ (cond ((mouse-event-p key) nil) ++ ((keymapp binding) ++ (setq tail ++ (notmuch-describe-keymap ++ binding ua-keys (notmuch-prefix-key-description key) tail))) ++ (t ++ (when (and ua-keys (symbolp binding) ++ (get binding 'notmuch-prefix-doc)) ++ ;; Documentation for prefixed command ++ (let ((ua-desc (key-description ua-keys))) ++ (push (concat ua-desc " " prefix (format-kbd-macro (vector key)) ++ "\t" (get binding 'notmuch-prefix-doc)) ++ tail))) ++ ;; Documentation for command ++ (push (concat prefix (format-kbd-macro (vector key)) "\t" ++ (or (and (symbolp binding) (get binding 'notmuch-doc)) ++ (notmuch-documentation-first-line binding))) ++ tail))))) ++ keymap)) + tail) + + (defun notmuch-substitute-command-keys (doc) +-- +1.7.9.1 + -- 2.26.2