From 6f616bd733eaa010eb68dd588d56d5d909f1631d Mon Sep 17 00:00:00 2001 From: Mark Walters Date: Tue, 12 Nov 2013 20:10:54 +0000 Subject: [PATCH] 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. --- emacs/notmuch-lib.el | 12 +++++++----- 1 file 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)) -- 2.26.2