1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2025-12-05 22:20:24 -08:00

; elisp-scope.el: Fix error during widget args analysis

* lisp/emacs-lisp/elisp-scope.el (elisp-scope--match-spec-to-arg):
Simplify and fix handling of empty list.

* test/lisp/progmodes/elisp-mode-resources/semantic-highlighting.el:
Add test.
This commit is contained in:
Eshel Yaron 2025-10-21 11:07:08 +02:00
parent 93dcc342a5
commit 9f35d1653f
No known key found for this signature in database
GPG key ID: EF3EE9CA35D78618
2 changed files with 11 additions and 8 deletions

View file

@ -2685,8 +2685,7 @@ ARGS bound to the analyzed arguments."
(let ((symbols-with-pos-enabled t)) (and (member arg (cdr spec)) t)))
(cl-defmethod elisp-scope--match-spec-to-arg ((spec (head plist)) arg)
(cond
((consp arg)
(when (listp arg)
(let ((res nil) (go t))
(while (and arg go)
(let* ((key (car arg))
@ -2695,17 +2694,14 @@ ARGS bound to the analyzed arguments."
(push (if (keywordp bkw) '(symbol . constant) t) res)
(push (setq go (elisp-scope--match-spec-to-arg (alist-get bkw (cdr spec) t) val)) res))
(setq arg (cddr arg)))
(when go (cons 'list (nreverse res)))))
((null arg) t)))
(when go (cons 'list (nreverse res))))))
(cl-defmethod elisp-scope--match-spec-to-arg ((spec (head list)) arg)
(cond
((consp arg)
(when (listp arg)
(let ((specs (cdr spec)) (go t) res)
(while (and specs (setq go (elisp-scope--match-spec-to-arg (pop specs) (pop arg))))
(push go res))
(when go (cons 'list (nreverse res)))))
((null arg) t)))
(when go (cons 'list (nreverse res))))))
(cl-defmethod elisp-scope--match-spec-to-arg ((spec (head plist-and-then)) arg)
(cond

View file

@ -150,6 +150,13 @@
)))
:version "29.1")
;; Taken from browse-url.el:
(defcustom baz-opt 'browse-url-mail
"Baz."
:type '(function-item :tag "Emacs Mail" :value browse-url-mail))
;; ^ elisp-widget-type
;; ^ (elisp-constant font-lock-builtin-face)
(e-s-analyze-form #'ignore)
;; ^ (elisp-shorthand-font-lock-face elisp-function)
;; ^ elisp-function