From: Eshel Yaron Date: Tue, 18 Feb 2025 08:40:22 +0000 (+0100) Subject: scope.el: Special handling for cl-letf X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=c2adb89a954a29dd6ad1b561dbb04a12a312be64;p=emacs.git scope.el: Special handling for cl-letf --- diff --git a/lisp/emacs-lisp/scope.el b/lisp/emacs-lisp/scope.el index eb00cd17859..87b073f0cac 100644 --- a/lisp/emacs-lisp/scope.el +++ b/lisp/emacs-lisp/scope.el @@ -1437,6 +1437,20 @@ a (possibly empty) list of safe macros.") (put 'defmacro 'scope-analyzer #'scope--analyze-defun) (put 'ert-deftest 'scope-analyzer #'scope--analyze-defun) +(scope-define-macro-analyzer cl-letf (l bindings &rest body) + (let ((l0 l)) + (dolist (binding bindings) + (let ((place (car binding))) + (if (or (symbol-with-pos-p place) (symbolp place)) + (let* ((bare (bare-symbol place)) + (len (length (symbol-name bare))) + (beg (scope-sym-pos place))) + (when beg (scope-report 'variable beg len beg)) + (setq l (scope-local-new bare beg l))) + (scope-1 l0 place)) + (scope-1 l0 (cadr binding)))) + (scope-n l body))) + (scope-define-macro-analyzer setf (l &rest args) (scope-n l args))