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 2776A431FCF for ; Thu, 7 Nov 2013 10:52:46 -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 GPQ3eIbkzjIq for ; Thu, 7 Nov 2013 10:52:38 -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 955E7431FBC for ; Thu, 7 Nov 2013 10:52:38 -0800 (PST) X-AuditID: 12074423-b7fac8e00000539e-64-527be174a691 Received: from mailhub-auth-3.mit.edu ( [18.9.21.43]) (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 39.7A.21406.471EB725; Thu, 7 Nov 2013 13:52:36 -0500 (EST) Received: from outgoing.mit.edu (outgoing-auth-1.mit.edu [18.9.28.11]) by mailhub-auth-3.mit.edu (8.13.8/8.9.2) with ESMTP id rA7IqYAP011629; Thu, 7 Nov 2013 13:52:35 -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 rA7IqW0G019257 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES128-SHA bits=128 verify=NOT); Thu, 7 Nov 2013 13:52:33 -0500 Received: from amthrax by awakening.csail.mit.edu with local (Exim 4.80) (envelope-from ) id 1VeUgy-0003wi-6I; Thu, 07 Nov 2013 13:52:32 -0500 From: Austin Clements To: Mark Walters , notmuch@notmuchmail.org Subject: Re: [PATCH 1/4] emacs: help: check for nil key binding In-Reply-To: <1382821479-23384-2-git-send-email-markwalters1009@gmail.com> References: <1382821479-23384-1-git-send-email-markwalters1009@gmail.com> <1382821479-23384-2-git-send-email-markwalters1009@gmail.com> User-Agent: Notmuch/0.16+110~g45444ee (http://notmuchmail.org) Emacs/23.4.1 (i486-pc-linux-gnu) Date: Thu, 07 Nov 2013 13:52:31 -0500 Message-ID: <87k3gkkpsg.fsf@awakening.csail.mit.edu> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFnrIIsWRmVeSWpSXmKPExsUixCmqrVvysDrI4NxBEYvVc3ksrt+cyezA 5LFz1l12j2erbjEHMEVx2aSk5mSWpRbp2yVwZbybe4Ox4K5gxfEP31kaGB/wdjFyckgImEjM 2buBDcIWk7hwbz2QzcUhJDCbSeLNiV3sEM4GRom3z2YyQTinmCReNNwDaxESWMIo8feUPYjN JqAhsW3/ckYQW0TAVeLpt8/MILawgL3ErW/zmUBsTgEviesfl0ANameUmH5zP1hCVCBeYuq3 OewgNouAqsTb92/BBvEC3fdn+0N2CFtQ4uTMJywgNrOAlsSNfy+ZJjAKzEKSmoUktYCRaRWj bEpulW5uYmZOcWqybnFyYl5eapGumV5uZoleakrpJkZQSLK7KO9g/HNQ6RCjAAejEg/viUvV QUKsiWXFlbmHGCU5mJREeeUfAIX4kvJTKjMSizPii0pzUosPMUpwMCuJ8B5ZCJTjTUmsrEot yodJSXOwKInz3uKwDxISSE8sSc1OTS1ILYLJynBwKEnw6oAMFSxKTU+tSMvMKUFIM3Fwggzn ARruDFLDW1yQmFucmQ6RP8WoKCXOe/8+UEIAJJFRmgfXC0sZrxjFgV4R5vUEaecBphu47ldA g5mABof8qgQZXJKIkJJqYJyxaL+X9g3LLR6r42wFrhx3Xv7QUF8y+wxz5M66aqO/kXfaNi07 Vd9vyvJ1Gsf8RyueaaVUPrPN+/Cj1YlB4nhWgtKu1ckbDN0fWZjtf/z0o6Hk5ZcPL3vd7vvo J6W38MDmvEOTyj3u/5vi/6C18blR42XvlVff7X6oHywflBh+XfqzdkH46iVKLMUZiYZazEXF iQDwUYB49AIAAA== 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: Thu, 07 Nov 2013 18:52:46 -0000 On Sat, 26 Oct 2013, Mark Walters wrote: > 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 Change "t" to "binding" instead of wrapping the whole body in an unless? > - (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 > > _______________________________________________ > notmuch mailing list > notmuch@notmuchmail.org > http://notmuchmail.org/mailman/listinfo/notmuch