From 920563a32e5129c1b612e2c5f7bd6c7372711834 Mon Sep 17 00:00:00 2001 From: Eshel Yaron Date: Sun, 23 Feb 2025 09:00:54 +0100 Subject: [PATCH] scope.el: Improve seq-let handling --- lisp/emacs-lisp/scope.el | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/lisp/emacs-lisp/scope.el b/lisp/emacs-lisp/scope.el index 87b073f0cac..d37db1e64f0 100644 --- a/lisp/emacs-lisp/scope.el +++ b/lisp/emacs-lisp/scope.el @@ -1227,7 +1227,7 @@ a (possibly empty) list of safe macros.") (dolist (hook hooks) (when-let ((q (scope--unqoute hook))) (scope-report-s q 'variable)))) -(scope-define-function-analyzer signal (error-symbol _data) +(scope-define-function-analyzer signal (error-symbol &optional _data) (when-let ((q (scope--unqoute error-symbol))) (scope-report-s q 'condition))) (scope-define-function-analyzer fboundp (symbol) @@ -1460,6 +1460,18 @@ a (possibly empty) list of safe macros.") static-if eval-when-compile eval-and-compile)) (put sym 'scope-analyzer #'scope--analyze-setf)) +(scope-define-macro-analyzer seq-let (l args sequence &rest body) + (scope-1 l sequence) + (dolist (arg args) + (let* ((bare (scope-sym-bare arg)) + (len (length (symbol-name bare))) + (beg (scope-sym-pos arg))) + (if (eq bare '&rest) + (scope-report 'ampersand beg len) + (when beg (scope-report 'variable beg len beg)) + (setq l (scope-local-new bare beg l))))) + (scope-n l body)) + (scope-define-analyzer let-alist (l f alist &rest body) (scope-report-s f 'macro) (scope-1 l alist) -- 2.39.5