[PATCH 1/4] emacs: help: check for nil key binding

Austin Clements amdragon at MIT.EDU
Thu Nov 7 10:52:31 PST 2013


On Sat, 26 Oct 2013, Mark Walters <markwalters1009 at gmail.com> 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 at notmuchmail.org
> http://notmuchmail.org/mailman/listinfo/notmuch


More information about the notmuch mailing list