aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDmitry Gutov2024-10-06 04:31:31 +0300
committerDmitry Gutov2024-10-06 04:32:00 +0300
commite776df2a3eae0454ea85287e15ebba649bf8e918 (patch)
treeb93d602a9a2ced676570b570e184cd4dffe1a848
parent4c7a6dc1a0ce8fe7bb603c907efb52d2ecf30858 (diff)
downloademacs-e776df2a3eae0454ea85287e15ebba649bf8e918.tar.gz
emacs-e776df2a3eae0454ea85287e15ebba649bf8e918.zip
help-setup-xref: Keep the local values only of some variables
* lisp/help-mode.el (help-setup-xref): Kill all local variables, saving ones that are known to need to be preserved (bug#73637).
-rw-r--r--lisp/help-mode.el37
1 files changed, 13 insertions, 24 deletions
diff --git a/lisp/help-mode.el b/lisp/help-mode.el
index 7bb69a9389f..a44749d1fe9 100644
--- a/lisp/help-mode.el
+++ b/lisp/help-mode.el
@@ -505,30 +505,19 @@ This should be called very early, before the output buffer is cleared,
505because we want to record the \"previous\" position of point so we can 505because we want to record the \"previous\" position of point so we can
506restore it properly when going back." 506restore it properly when going back."
507 (with-current-buffer (help-buffer) 507 (with-current-buffer (help-buffer)
508 ;; Disable `outline-minor-mode' in a reused Help buffer 508 (let ((stack-item help-xref-stack-item)
509 ;; created by `describe-bindings' that enables this mode. 509 (stack help-xref-stack))
510 (when (bound-and-true-p outline-minor-mode) 510 (kill-all-local-variables)
511 (outline-minor-mode -1) 511 (setq help-xref-stack-item stack-item
512 (mapc #'kill-local-variable 512 help-xref-stack stack)
513 '(outline-search-function 513 (when help-xref-stack-item
514 outline-regexp 514 (push (cons (point) help-xref-stack-item) help-xref-stack)
515 outline-heading-end-regexp 515 (setq help-xref-forward-stack nil))
516 outline-level 516 (when interactive-p
517 outline-minor-mode-cycle 517 (let ((tail (nthcdr 10 help-xref-stack)))
518 outline-minor-mode-highlight 518 ;; Truncate the stack.
519 outline-minor-mode-use-buttons 519 (if tail (setcdr tail nil))))
520 outline-default-state 520 (setq help-xref-stack-item item))))
521 outline-default-rules)))
522 (kill-local-variable 'xref-backend-functions)
523 (kill-local-variable 'semantic-symref-filepattern-alist)
524 (when help-xref-stack-item
525 (push (cons (point) help-xref-stack-item) help-xref-stack)
526 (setq help-xref-forward-stack nil))
527 (when interactive-p
528 (let ((tail (nthcdr 10 help-xref-stack)))
529 ;; Truncate the stack.
530 (if tail (setcdr tail nil))))
531 (setq help-xref-stack-item item)))
532 521
533(defvar help-xref-following nil 522(defvar help-xref-following nil
534 "Non-nil when following a help cross-reference.") 523 "Non-nil when following a help cross-reference.")