diff options
author | Stefan Kangas <stefan@marxist.se> | 2020-11-01 16:31:12 +0100 |
---|---|---|
committer | Stefan Kangas <stefan@marxist.se> | 2020-11-01 18:58:12 +0100 |
commit | 8ad9932f1163506370ee05a0d7a2f2d5d57c0fd1 (patch) | |
tree | c27c597a89cac9a39bfae8fd7ada2b0cabaf62f5 | |
parent | 8761c155e43c08428054677c75781e312a728667 (diff) | |
download | emacs-8ad9932f1163506370ee05a0d7a2f2d5d57c0fd1.tar.gz |
Don't bind standard-output in substitute-command-keys
This fixes a regression with regards to the old C version of
substitute-command-keys.
* lisp/help.el (substitute-command-keys): Don't bind standard-output.
See Bug#39149.
* test/lisp/help-tests.el
(help-tests--was-in-buffer): New variable.
(help-substitute-command-keys/menu-filter-in-correct-buffer): New
test.
-rw-r--r-- | lisp/help.el | 3 | ||||
-rw-r--r-- | test/lisp/help-tests.el | 20 |
2 files changed, 21 insertions, 2 deletions
diff --git a/lisp/help.el b/lisp/help.el index 795f7e74d8b..df055d602fe 100644 --- a/lisp/help.el +++ b/lisp/help.el @@ -1013,8 +1013,7 @@ Otherwise, return a new string (without any text properties)." (insert string) (goto-char (point-min)) (while (< (point) (point-max)) - (let ((standard-output (current-buffer)) - (orig-point (point)) + (let ((orig-point (point)) end-point active-maps close generate-summary) (cond diff --git a/test/lisp/help-tests.el b/test/lisp/help-tests.el index 079b1114a81..b6dffb2a405 100644 --- a/test/lisp/help-tests.el +++ b/test/lisp/help-tests.el @@ -361,6 +361,26 @@ C-b undefined "))))) +(defvar help-tests--was-in-buffer nil) + +(ert-deftest help-substitute-command-keys/menu-filter-in-correct-buffer () + "Evaluate menu-filter in the original buffer. See Bug#39149." + (unwind-protect + (progn + (define-key global-map (kbd "C-c C-l r") + `(menu-item "2" identity + :filter ,(lambda (cmd) + (setq help-tests--was-in-buffer + (current-buffer)) + cmd))) + (with-temp-buffer + (substitute-command-keys "\\[identity]") + (should (eq help-tests--was-in-buffer + (current-buffer))))) + (setq help-tests--was-in-buffer nil) + (define-key global-map (kbd "C-c C-l r") nil) + (define-key global-map (kbd "C-c C-l") nil))) + (provide 'help-tests) ;;; help-tests.el ends here |