Re: [PATCH 1/4] emacs: help: check for nil key binding
authorAustin Clements <amdragon@MIT.EDU>
Thu, 7 Nov 2013 18:52:31 +0000 (13:52 +1900)
committerW. Trevor King <wking@tremily.us>
Fri, 7 Nov 2014 17:58:04 +0000 (09:58 -0800)
c9/b847d3df375960edc7fdfc5c3d79394636d4e4 [new file with mode: 0644]

diff --git a/c9/b847d3df375960edc7fdfc5c3d79394636d4e4 b/c9/b847d3df375960edc7fdfc5c3d79394636d4e4
new file mode 100644 (file)
index 0000000..9a06339
--- /dev/null
@@ -0,0 +1,136 @@
+Return-Path: <amdragon@mit.edu>\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 2776A431FCF\r
+       for <notmuch@notmuchmail.org>; Thu,  7 Nov 2013 10:52:46 -0800 (PST)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: -0.7\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=-0.7 tagged_above=-999 required=5\r
+       tests=[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 GPQ3eIbkzjIq for <notmuch@notmuchmail.org>;\r
+       Thu,  7 Nov 2013 10:52:38 -0800 (PST)\r
+Received: from dmz-mailsec-scanner-6.mit.edu (dmz-mailsec-scanner-6.mit.edu\r
+       [18.7.68.35])\r
+       (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits))\r
+       (No client certificate requested)\r
+       by olra.theworths.org (Postfix) with ESMTPS id 955E7431FBC\r
+       for <notmuch@notmuchmail.org>; Thu,  7 Nov 2013 10:52:38 -0800 (PST)\r
+X-AuditID: 12074423-b7fac8e00000539e-64-527be174a691\r
+Received: from mailhub-auth-3.mit.edu ( [18.9.21.43])\r
+       (using TLS with cipher AES256-SHA (256/256 bits))\r
+       (Client did not present a certificate)\r
+       by dmz-mailsec-scanner-6.mit.edu (Symantec Messaging Gateway) with SMTP\r
+       id 39.7A.21406.471EB725; Thu,  7 Nov 2013 13:52:36 -0500 (EST)\r
+Received: from outgoing.mit.edu (outgoing-auth-1.mit.edu [18.9.28.11])\r
+       by mailhub-auth-3.mit.edu (8.13.8/8.9.2) with ESMTP id rA7IqYAP011629; \r
+       Thu, 7 Nov 2013 13:52:35 -0500\r
+Received: from awakening.csail.mit.edu (awakening.csail.mit.edu [18.26.4.91])\r
+       (authenticated bits=0)\r
+       (User authenticated as amdragon@ATHENA.MIT.EDU)\r
+       by outgoing.mit.edu (8.13.8/8.12.4) with ESMTP id rA7IqW0G019257\r
+       (version=TLSv1/SSLv3 cipher=DHE-RSA-AES128-SHA bits=128 verify=NOT);\r
+       Thu, 7 Nov 2013 13:52:33 -0500\r
+Received: from amthrax by awakening.csail.mit.edu with local (Exim 4.80)\r
+       (envelope-from <amdragon@mit.edu>)\r
+       id 1VeUgy-0003wi-6I; Thu, 07 Nov 2013 13:52:32 -0500\r
+From: Austin Clements <amdragon@MIT.EDU>\r
+To: Mark Walters <markwalters1009@gmail.com>, notmuch@notmuchmail.org\r
+Subject: Re: [PATCH 1/4] emacs: help: check for nil key binding\r
+In-Reply-To: <1382821479-23384-2-git-send-email-markwalters1009@gmail.com>\r
+References: <1382821479-23384-1-git-send-email-markwalters1009@gmail.com>\r
+       <1382821479-23384-2-git-send-email-markwalters1009@gmail.com>\r
+User-Agent: Notmuch/0.16+110~g45444ee (http://notmuchmail.org) Emacs/23.4.1\r
+       (i486-pc-linux-gnu)\r
+Date: Thu, 07 Nov 2013 13:52:31 -0500\r
+Message-ID: <87k3gkkpsg.fsf@awakening.csail.mit.edu>\r
+MIME-Version: 1.0\r
+Content-Type: text/plain; charset=us-ascii\r
+X-Brightmail-Tracker:\r
+ H4sIAAAAAAAAA+NgFnrIIsWRmVeSWpSXmKPExsUixCmqrVvysDrI4NxBEYvVc3ksrt+cyezA\r
+       5LFz1l12j2erbjEHMEVx2aSk5mSWpRbp2yVwZbybe4Ox4K5gxfEP31kaGB/wdjFyckgImEjM\r
+       2buBDcIWk7hwbz2QzcUhJDCbSeLNiV3sEM4GRom3z2YyQTinmCReNNwDaxESWMIo8feUPYjN\r
+       JqAhsW3/ckYQW0TAVeLpt8/MILawgL3ErW/zmUBsTgEviesfl0ANameUmH5zP1hCVCBeYuq3\r
+       OewgNouAqsTb92/BBvEC3fdn+0N2CFtQ4uTMJywgNrOAlsSNfy+ZJjAKzEKSmoUktYCRaRWj\r
+       bEpulW5uYmZOcWqybnFyYl5eapGumV5uZoleakrpJkZQSLK7KO9g/HNQ6RCjAAejEg/viUvV\r
+       QUKsiWXFlbmHGCU5mJREeeUfAIX4kvJTKjMSizPii0pzUosPMUpwMCuJ8B5ZCJTjTUmsrEot\r
+       yodJSXOwKInz3uKwDxISSE8sSc1OTS1ILYLJynBwKEnw6oAMFSxKTU+tSMvMKUFIM3Fwggzn\r
+       ARruDFLDW1yQmFucmQ6RP8WoKCXOe/8+UEIAJJFRmgfXC0sZrxjFgV4R5vUEaecBphu47ldA\r
+       g5mABof8qgQZXJKIkJJqYJyxaL+X9g3LLR6r42wFrhx3Xv7QUF8y+wxz5M66aqO/kXfaNi07\r
+       Vd9vyvJ1Gsf8RyueaaVUPrPN+/Cj1YlB4nhWgtKu1ckbDN0fWZjtf/z0o6Hk5ZcPL3vd7vvo\r
+       J6W38MDmvEOTyj3u/5vi/6C18blR42XvlVff7X6oHywflBh+XfqzdkH46iVKLMUZiYZazEXF\r
+       iQDwUYB49AIAAA==\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: Thu, 07 Nov 2013 18:52:46 -0000\r
+\r
+On Sat, 26 Oct 2013, Mark Walters <markwalters1009@gmail.com> wrote:\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
+\r
+Change "t" to "binding" instead of wrapping the whole body in an unless?\r
+\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
+> _______________________________________________\r
+> notmuch mailing list\r
+> notmuch@notmuchmail.org\r
+> http://notmuchmail.org/mailman/listinfo/notmuch\r