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 501DD429E4E for ; Sat, 26 Oct 2013 14:04:53 -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 PqlhdbKr05eP for ; Sat, 26 Oct 2013 14:04:47 -0700 (PDT) Received: from mail-wg0-f47.google.com (mail-wg0-f47.google.com [74.125.82.47]) (using TLSv1 with cipher RC4-SHA (128/128 bits)) (No client certificate requested) by olra.theworths.org (Postfix) with ESMTPS id A6C14429E42 for ; Sat, 26 Oct 2013 14:04:47 -0700 (PDT) Received: by mail-wg0-f47.google.com with SMTP id c11so5212098wgh.14 for ; Sat, 26 Oct 2013 14:04:45 -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=jRjElwHlkrkuE2SLKigukbex+6l62KeyHpV9q+wvP0M=; b=CoOAx4G5jvVzQWtsan8O9LomDi9/glJrxwAW3+NPndQfBf4U37EZJqk8Z6a9qivmFk 48fXFTeNANf9AOHI9GgcbHrhaB8b3zSX9ZY6/5kI1n2jZ6Svzl7/O9L/JYh6wSHB+ImW Bawq1rwwrysvPJfSq9pEX2jXjoOOjls++6b6q2lLejwza6QA+dultlpHjrp8teYSkxFL FM2t7LKp7fsbByvAixBTxZTZoWUyaCI6t9lOBjwxGkBveaZO7i4zizdtwBwqNmRykknA +mxoRGucRxxC6Nb3XaaZ578UJsFZqJSoQFYbaKbSjhbPmaxy+pju7z6JEgwSdfaamyKi bapg== X-Received: by 10.194.19.5 with SMTP id a5mr1275267wje.48.1382821484945; Sat, 26 Oct 2013 14:04:44 -0700 (PDT) Received: from localhost (93-97-24-31.zone5.bethere.co.uk. [93.97.24.31]) by mx.google.com with ESMTPSA id ft19sm19503468wic.5.2013.10.26.14.04.44 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Sat, 26 Oct 2013 14:04:44 -0700 (PDT) From: Mark Walters To: notmuch@notmuchmail.org Subject: [PATCH 1/4] emacs: help: check for nil key binding Date: Sat, 26 Oct 2013 22:04:36 +0100 Message-Id: <1382821479-23384-2-git-send-email-markwalters1009@gmail.com> X-Mailer: git-send-email 1.7.9.1 In-Reply-To: <1382821479-23384-1-git-send-email-markwalters1009@gmail.com> References: <1382821479-23384-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: Sat, 26 Oct 2013 21:04:53 -0000 A standard way to unset a key binding is local-unset-key which is equivalent to (define-key (current-local-map) key nil) Currently notmuch-help gives an error and fails if a user has done this. To fix this we check for a nil binding before adding a help line. --- emacs/notmuch.el | 25 +++++++++++++------------ 1 files changed, 13 insertions(+), 12 deletions(-) diff --git a/emacs/notmuch.el b/emacs/notmuch.el index 6081245..f98f8cf 100644 --- a/emacs/notmuch.el +++ b/emacs/notmuch.el @@ -158,18 +158,19 @@ prefix argument. PREFIX and TAIL are used internally." (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)))) + (unless (not binding) + (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) -- 1.7.9.1