1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2026-04-18 12:00:38 -07:00

Improve `forward-sexp' in *Help* buffers

* lisp/help-mode.el (help-mode-syntax-table): New variable (bug#39134).
(help-make-xrefs): Use it to make picking out symbols in curved
quotes work reliably.
(help-xref-on-pp): Ditto.
This commit is contained in:
Michalis V 2021-08-17 14:20:57 +02:00 committed by Lars Ingebrigtsen
parent e6fb7e44cc
commit 00fdf80e21

View file

@ -140,6 +140,15 @@ The format is (FUNCTION ARGS...).")
(setq-default help-xref-stack nil help-xref-stack-item nil)
(setq-default help-xref-forward-stack nil help-xref-forward-stack-item nil)
(defvar help-mode-syntax-table
(let ((table (make-syntax-table emacs-lisp-mode-syntax-table)))
;; treat single quotes as parens so that forward-sexp does not
;; break when quoted string contains punctuation
(modify-syntax-entry ? "( " table)
(modify-syntax-entry ? ") " table)
table)
"Syntax table used in `help-mode'.")
(defcustom help-mode-hook nil
"Hook run by `help-mode'."
:type 'hook
@ -520,7 +529,7 @@ that."
(let ((stab (syntax-table))
(case-fold-search t)
(inhibit-read-only t))
(set-syntax-table emacs-lisp-mode-syntax-table)
(set-syntax-table help-mode-syntax-table)
;; The following should probably be abstracted out.
(unwind-protect
(progn
@ -673,7 +682,7 @@ See `help-make-xrefs'."
(defun help-xref-on-pp (from to)
"Add xrefs for symbols in `pp's output between FROM and TO."
(if (> (- to from) 5000) nil
(with-syntax-table emacs-lisp-mode-syntax-table
(with-syntax-table help-mode-syntax-table
(save-excursion
(save-restriction
(narrow-to-region from to)