[PATCH v4 0/7] emacs: help: remap keybindings

Austin Clements amdragon at MIT.EDU
Tue Nov 12 14:46:22 PST 2013


LGTM.

Quoth Mark Walters on Nov 12 at  8:10 pm:
> This is v4 of this patch set. v3 is at id:1383932419-12533-1-git-send-email-markwalters1009 at gmail.com.
> 
> David found a bug in v3 which I tracked down to some match-data being
> over-written. This included the bugfix
> id:1384076682-16872-1-git-send-email-markwalters1009 at gmail.com which
> is folded into this series as the second patch.
> 
> The diff v3+bugfix is below: it does the save-match-data as Austin
> suggested, and it removes an accidental added comment which I put in
> when finding the bug.
> 
> I have also left off the last "testing patch" (a patch that added some
> functionality to make it easier to test the help routine but not
> something that should be added to mainline)
> 
> Best wishes
> 
> Mark
> 
> diff --git a/emacs/notmuch-lib.el b/emacs/notmuch-lib.el
> index 20ed1fb..0655bdd 100644
> --- a/emacs/notmuch-lib.el
> +++ b/emacs/notmuch-lib.el
> @@ -305,16 +305,15 @@ prefix argument.  PREFIX and TAIL are used internally."
>  (defun notmuch-substitute-command-keys (doc)
>    "Like `substitute-command-keys' but with documentation, not function names."
>    (let ((beg 0))
> -    (while (string-match "\\\\{\\([^}[:space:]]*\\)}" doc beg) ;; matches \{not-space}
> +    (while (string-match "\\\\{\\([^}[:space:]]*\\)}" doc beg)
>        (let ((desc
>  	     (save-match-data
>  	       (let* ((keymap-name (substring doc (match-beginning 1) (match-end 1)))
>  		      (keymap (symbol-value (intern keymap-name)))
>  		      (ua-keys (where-is-internal 'universal-argument keymap t))
>  		      (desc-alist (notmuch-describe-keymap keymap ua-keys keymap))
> -		      (desc-list (mapcar (lambda (arg) (concat (car arg) "\t" (cdr arg))) desc-alist))
> -		      (desc (mapconcat #'identity desc-list "\n")))
> -		 desc))))
> +		      (desc-list (mapcar (lambda (arg) (concat (car arg) "\t" (cdr arg))) desc-alist)))
> +		 (mapconcat #'identity desc-list "\n")))))
>  	(setq doc (replace-match desc 1 1 doc)))
>        (setq beg (match-end 0)))
>      doc))
> 
> 
> 
> 
> Mark Walters (7):
>   emacs: help: check for nil key binding
>   emacs: help: save-match-data
>   emacs: help: remove duplicate bindings
>   emacs: help: split out notmuch-describe-key as a function
>   emacs: help: add base-keymap
>   emacs: help: add a special function to deal with remaps
>   emacs: tree: use remap for the over-ridden global bindings
> 
>  emacs/notmuch-lib.el  |   85 ++++++++++++++++++++++++++++++++++--------------
>  emacs/notmuch-tree.el |    8 ++--
>  2 files changed, 64 insertions(+), 29 deletions(-)
> 


More information about the notmuch mailing list