diff options
author | Mark Walters <markwalters1009@gmail.com> | 2013-11-12 20:10:54 +0000 |
---|---|---|
committer | David Bremner <david@tethera.net> | 2013-11-13 21:33:14 -0400 |
commit | 6f616bd733eaa010eb68dd588d56d5d909f1631d (patch) | |
tree | f8c5bfe8e6bc3b1c0c78d3f449f5abc011ae721f /emacs | |
parent | a5ecdf390e4dca6a314cee1594ab3236ea62ca85 (diff) |
emacs: help: save-match-data
The routines that construct the help page in notmuch-lib rely on
match-data being preserved across some fairly complicated code. This
is currently valid but will not be when this series is finished. Thus
place everything between the string-match and replace-match inside a
save-match-data.
Diffstat (limited to 'emacs')
-rw-r--r-- | emacs/notmuch-lib.el | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/emacs/notmuch-lib.el b/emacs/notmuch-lib.el index 4c615474..623f4fad 100644 --- a/emacs/notmuch-lib.el +++ b/emacs/notmuch-lib.el @@ -273,11 +273,13 @@ prefix argument. PREFIX and TAIL are used internally." "Like `substitute-command-keys' but with documentation, not function names." (let ((beg 0)) (while (string-match "\\\\{\\([^}[:space:]]*\\)}" doc beg) - (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-list (notmuch-describe-keymap keymap ua-keys)) - (desc (mapconcat #'identity desc-list "\n"))) + (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-list (notmuch-describe-keymap keymap ua-keys))) + (mapconcat #'identity desc-list "\n"))))) (setq doc (replace-match desc 1 1 doc))) (setq beg (match-end 0))) doc)) |