From dc3604cadfa8f4bc3e5d9346029e48b4268fcd60 Mon Sep 17 00:00:00 2001 From: Alan Mackenzie Date: Sat, 11 Feb 2023 10:45:31 +0000 Subject: Make edebug see unused variables when lexical-binding is non-nil This fixes bug #59213. * lisp/emacs-lisp/cconv.el (cconv-dont-trim-unused-variables): New variable. (cconv-fv, cconv-make-interpreted-closure): Add/amend doc strings. (cconv-make-interpreted-closure): Test cconv-dont-trim-unused-variables, and if non-nil, don't "optimize" the lexical environment. * lisp/emacs-lisp/edebug.el (edebug-make-enter-wrapper): Compile a binding of cconv-dont-trim-unused-variables to t around the call of edebug-enter. * lisp/emacs-lisp/testconver.el (testcover-analyze-coverage): Add a new arm to the pcase form to handle the new form of edebug-enter. --- lisp/emacs-lisp/edebug.el | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) (limited to 'lisp/emacs-lisp/edebug.el') diff --git a/lisp/emacs-lisp/edebug.el b/lisp/emacs-lisp/edebug.el index 2f7d03e9d79..735a358cdba 100644 --- a/lisp/emacs-lisp/edebug.el +++ b/lisp/emacs-lisp/edebug.el @@ -1217,16 +1217,16 @@ purpose by adding an entry to this alist, and setting (setq edebug-old-def-name nil)) (setq edebug-def-name (or edebug-def-name edebug-old-def-name (gensym "edebug-anon"))) - `(edebug-enter - (quote ,edebug-def-name) - ,(if edebug-inside-func - `(list - ;; Doesn't work with more than one def-body!! - ;; But the list will just be reversed. - ,@(nreverse edebug-def-args)) - 'nil) - (function (lambda () ,@forms)) - )) + `(let ((cconv-dont-trim-unused-variables t)) + (edebug-enter + (quote ,edebug-def-name) + ,(if edebug-inside-func + `(list + ;; Doesn't work with more than one def-body!! + ;; But the list will just be reversed. + ,@(nreverse edebug-def-args)) + 'nil) + (function (lambda () ,@forms))))) (defvar edebug-form-begin-marker) ; the mark for def being instrumented -- cgit v1.2.3