From: John Wiegley Date: Tue, 5 Dec 2017 21:26:03 +0000 (-0800) Subject: Enhance fix-expansion to take surrounding let bindings into account X-Git-Tag: emacs-29.0.90~1306^2~15^2~137 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=64ffdb68631b349de6083677210ab9aec2768fd9;p=emacs.git Enhance fix-expansion to take surrounding let bindings into account --- diff --git a/test/lisp/use-package/use-package-tests.el b/test/lisp/use-package/use-package-tests.el index 966c1221ba4..7109d58ea1f 100644 --- a/test/lisp/use-package/use-package-tests.el +++ b/test/lisp/use-package/use-package-tests.el @@ -81,9 +81,19 @@ (goto-char (match-beginning 0)) (let ((decl (read (current-buffer)))) (kill-sexp) - (let ((use-package-verbose 'errors) - (use-package-expand-minimally t)) - (insert ?\n ?\` (pp-to-string (macroexpand-1 decl)))))))) + (let (vars) + (catch 'exit + (save-excursion + (while (ignore-errors (backward-up-list) t) + (when (looking-at "(let\\s-+") + (goto-char (match-end 0)) + (setq vars (read (current-buffer))) + (throw 'exit t))))) + (eval + `(let (,@ (append vars + '((use-package-verbose 'errors) + (use-package-expand-minimally t)))) + (insert ?\n ?\` (pp-to-string (macroexpand-1 decl)))))))))) (bind-key "C-c C-u" #'fix-expansion emacs-lisp-mode-map)