[PATCH 1/4] emacs: help: check for nil key binding
authorMark Walters <markwalters1009@gmail.com>
Sat, 26 Oct 2013 21:04:36 +0000 (22:04 +0100)
committerW. Trevor King <wking@tremily.us>
Fri, 7 Nov 2014 17:57:39 +0000 (09:57 -0800)
be/474a02fd797f4699a1e5a26eb2d4cdbbb6d1d2 [new file with mode: 0644]

diff --git a/be/474a02fd797f4699a1e5a26eb2d4cdbbb6d1d2 b/be/474a02fd797f4699a1e5a26eb2d4cdbbb6d1d2
new file mode 100644 (file)
index 0000000..bfd885a
--- /dev/null
@@ -0,0 +1,111 @@
+Return-Path: <markwalters1009@gmail.com>\r
+X-Original-To: notmuch@notmuchmail.org\r
+Delivered-To: notmuch@notmuchmail.org\r
+Received: from localhost (localhost [127.0.0.1])\r
+       by olra.theworths.org (Postfix) with ESMTP id 501DD429E4E\r
+       for <notmuch@notmuchmail.org>; Sat, 26 Oct 2013 14:04:53 -0700 (PDT)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: 0.201\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=0.201 tagged_above=-999 required=5\r
+       tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1,\r
+       FREEMAIL_ENVFROM_END_DIGIT=1, FREEMAIL_FROM=0.001,\r
+       RCVD_IN_DNSWL_LOW=-0.7] autolearn=disabled\r
+Received: from olra.theworths.org ([127.0.0.1])\r
+       by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
+       with ESMTP id PqlhdbKr05eP for <notmuch@notmuchmail.org>;\r
+       Sat, 26 Oct 2013 14:04:47 -0700 (PDT)\r
+Received: from mail-wg0-f47.google.com (mail-wg0-f47.google.com\r
+ [74.125.82.47])       (using TLSv1 with cipher RC4-SHA (128/128 bits))        (No client\r
+ certificate requested)        by olra.theworths.org (Postfix) with ESMTPS id\r
+ A6C14429E42   for <notmuch@notmuchmail.org>; Sat, 26 Oct 2013 14:04:47 -0700\r
+ (PDT)\r
+Received: by mail-wg0-f47.google.com with SMTP id c11so5212098wgh.14\r
+       for <notmuch@notmuchmail.org>; Sat, 26 Oct 2013 14:04:45 -0700 (PDT)\r
+DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113;\r
+       h=from:to:cc:subject:date:message-id:in-reply-to:references;\r
+       bh=jRjElwHlkrkuE2SLKigukbex+6l62KeyHpV9q+wvP0M=;\r
+       b=CoOAx4G5jvVzQWtsan8O9LomDi9/glJrxwAW3+NPndQfBf4U37EZJqk8Z6a9qivmFk\r
+       48fXFTeNANf9AOHI9GgcbHrhaB8b3zSX9ZY6/5kI1n2jZ6Svzl7/O9L/JYh6wSHB+ImW\r
+       Bawq1rwwrysvPJfSq9pEX2jXjoOOjls++6b6q2lLejwza6QA+dultlpHjrp8teYSkxFL\r
+       FM2t7LKp7fsbByvAixBTxZTZoWUyaCI6t9lOBjwxGkBveaZO7i4zizdtwBwqNmRykknA\r
+       +mxoRGucRxxC6Nb3XaaZ578UJsFZqJSoQFYbaKbSjhbPmaxy+pju7z6JEgwSdfaamyKi\r
+       bapg==\r
+X-Received: by 10.194.19.5 with SMTP id a5mr1275267wje.48.1382821484945;\r
+       Sat, 26 Oct 2013 14:04:44 -0700 (PDT)\r
+Received: from localhost (93-97-24-31.zone5.bethere.co.uk. [93.97.24.31])\r
+       by mx.google.com with ESMTPSA id\r
+       ft19sm19503468wic.5.2013.10.26.14.04.44 for <multiple recipients>\r
+       (version=TLSv1.2 cipher=RC4-SHA bits=128/128);\r
+       Sat, 26 Oct 2013 14:04:44 -0700 (PDT)\r
+From: Mark Walters <markwalters1009@gmail.com>\r
+To: notmuch@notmuchmail.org\r
+Subject: [PATCH 1/4] emacs: help: check for nil key binding\r
+Date: Sat, 26 Oct 2013 22:04:36 +0100\r
+Message-Id: <1382821479-23384-2-git-send-email-markwalters1009@gmail.com>\r
+X-Mailer: git-send-email 1.7.9.1\r
+In-Reply-To: <1382821479-23384-1-git-send-email-markwalters1009@gmail.com>\r
+References: <1382821479-23384-1-git-send-email-markwalters1009@gmail.com>\r
+X-BeenThere: notmuch@notmuchmail.org\r
+X-Mailman-Version: 2.1.13\r
+Precedence: list\r
+List-Id: "Use and development of the notmuch mail system."\r
+       <notmuch.notmuchmail.org>\r
+List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
+       <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
+List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
+List-Post: <mailto:notmuch@notmuchmail.org>\r
+List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
+List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
+       <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
+X-List-Received-Date: Sat, 26 Oct 2013 21:04:53 -0000\r
+\r
+A standard way to unset a key binding is local-unset-key which is equivalent to\r
+     (define-key (current-local-map) key nil)\r
+Currently notmuch-help gives an error and fails if a user has done this.\r
+\r
+To fix this we check for a nil binding before adding a help line.\r
+---\r
+ emacs/notmuch.el |   25 +++++++++++++------------\r
+ 1 files changed, 13 insertions(+), 12 deletions(-)\r
+\r
+diff --git a/emacs/notmuch.el b/emacs/notmuch.el\r
+index 6081245..f98f8cf 100644\r
+--- a/emacs/notmuch.el\r
++++ b/emacs/notmuch.el\r
+@@ -158,18 +158,19 @@ prefix argument.  PREFIX and TAIL are used internally."\r
+                 (notmuch-describe-keymap\r
+                  binding ua-keys (notmuch-prefix-key-description key) tail)))\r
+          (t\r
+-          (when (and ua-keys (symbolp binding)\r
+-                     (get binding 'notmuch-prefix-doc))\r
+-            ;; Documentation for prefixed command\r
+-            (let ((ua-desc (key-description ua-keys)))\r
+-              (push (concat ua-desc " " prefix (format-kbd-macro (vector key))\r
+-                            "\t" (get binding 'notmuch-prefix-doc))\r
+-                    tail)))\r
+-          ;; Documentation for command\r
+-          (push (concat prefix (format-kbd-macro (vector key)) "\t"\r
+-                        (or (and (symbolp binding) (get binding 'notmuch-doc))\r
+-                            (notmuch-documentation-first-line binding)))\r
+-                tail))))\r
++          (unless (not binding)\r
++            (when (and ua-keys (symbolp binding)\r
++                       (get binding 'notmuch-prefix-doc))\r
++              ;; Documentation for prefixed command\r
++              (let ((ua-desc (key-description ua-keys)))\r
++                (push (concat ua-desc " " prefix (format-kbd-macro (vector key))\r
++                              "\t" (get binding 'notmuch-prefix-doc))\r
++                      tail)))\r
++            ;; Documentation for command\r
++            (push (concat prefix (format-kbd-macro (vector key)) "\t"\r
++                          (or (and (symbolp binding) (get binding 'notmuch-doc))\r
++                              (notmuch-documentation-first-line binding)))\r
++                  tail)))))\r
+    keymap)\r
+   tail)\r
\r
+-- \r
+1.7.9.1\r
+\r