From 9a5eafa8c3b6eae880937956b1f08374c17eb8a8 Mon Sep 17 00:00:00 2001 From: Vili Aapro Date: Sun, 1 Feb 2026 16:24:27 +0200 Subject: [PATCH] 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. --- lisp/progmodes/elisp-mode.el | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lisp/progmodes/elisp-mode.el b/lisp/progmodes/elisp-mode.el index 35737a90cdd..946d3ba10be 100644 --- a/lisp/progmodes/elisp-mode.el +++ b/lisp/progmodes/elisp-mode.el @@ -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)))