1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2025-12-06 06:20:55 -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))) (let ((symbols-with-pos-enabled t)) (and (member arg (cdr spec)) t)))
(cl-defmethod elisp-scope--match-spec-to-arg ((spec (head plist)) arg) (cl-defmethod elisp-scope--match-spec-to-arg ((spec (head plist)) arg)
(cond (when (listp arg)
((consp arg)
(let ((res nil) (go t)) (let ((res nil) (go t))
(while (and arg go) (while (and arg go)
(let* ((key (car arg)) (let* ((key (car arg))
@ -2695,17 +2694,14 @@ ARGS bound to the analyzed arguments."
(push (if (keywordp bkw) '(symbol . constant) t) res) (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)) (push (setq go (elisp-scope--match-spec-to-arg (alist-get bkw (cdr spec) t) val)) res))
(setq arg (cddr arg))) (setq arg (cddr arg)))
(when go (cons 'list (nreverse res))))) (when go (cons 'list (nreverse res))))))
((null arg) t)))
(cl-defmethod elisp-scope--match-spec-to-arg ((spec (head list)) arg) (cl-defmethod elisp-scope--match-spec-to-arg ((spec (head list)) arg)
(cond (when (listp arg)
((consp arg)
(let ((specs (cdr spec)) (go t) res) (let ((specs (cdr spec)) (go t) res)
(while (and specs (setq go (elisp-scope--match-spec-to-arg (pop specs) (pop arg)))) (while (and specs (setq go (elisp-scope--match-spec-to-arg (pop specs) (pop arg))))
(push go res)) (push go res))
(when go (cons 'list (nreverse res))))) (when go (cons 'list (nreverse res))))))
((null arg) t)))
(cl-defmethod elisp-scope--match-spec-to-arg ((spec (head plist-and-then)) arg) (cl-defmethod elisp-scope--match-spec-to-arg ((spec (head plist-and-then)) arg)
(cond (cond

View file

@ -150,6 +150,13 @@
))) )))
:version "29.1") :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) (e-s-analyze-form #'ignore)
;; ^ (elisp-shorthand-font-lock-face elisp-function) ;; ^ (elisp-shorthand-font-lock-face elisp-function)
;; ^ elisp-function ;; ^ elisp-function