elisp--highlight-function-argument: Handle special syntax correctly

* lisp/progmodes/elisp-mode.el
(elisp--highlight-function-argument): Handle special usage
syntax correctly when scanning usage arguments using
'forward-sexp' (bug#8432).  Before binding 'origin', skip over
blanks, so as not to highlight them, and to move immediately
before any possible opening square brackets.  After binding
'origin' and before calling 'forward-sexp', skip over opening
square brackets, so as to highlight them.  After calling
'forward-sexp' and before setting 'start' and 'end', skip over
closing square brackets and periods, so as to highlight them.
This commit is contained in:
Vili Aapro 2026-02-01 16:24:27 +02:00 committed by Sean Whitton
parent 8c39a17eef
commit 9a5eafa8c3

View file

@ -2447,12 +2447,15 @@ ARGS is the argument list of function SYM."
(insert args)
(goto-char (1+ (point-min)))
(while (and index (>= index 1))
(skip-chars-forward "[:blank:]")
(let ((origin (point)))
(skip-chars-forward "[")
(if (condition-case nil
(forward-sexp)
(:success t)
(scan-error nil))
(progn
(skip-chars-forward "].")
(setq start (- origin (point-min))
end (- (point) (point-min)))
(let ((argument (substring args start end)))