]> git.eshelyaron.com Git - emacs.git/commitdiff
Fix bug with M-x compile-defun in a defconst/defvar
authorAlan Mackenzie <acm@muc.de>
Wed, 2 Feb 2022 18:03:00 +0000 (18:03 +0000)
committerAlan Mackenzie <acm@muc.de>
Wed, 2 Feb 2022 18:03:00 +0000 (18:03 +0000)
* lisp/emacs-lisp/bytecomp.el (compile-defun): Have symbols-with-pos-enabled
bound to non-nil when the eval takes place.

lisp/emacs-lisp/bytecomp.el

index 9c664ff8fedb37bf1f9c332f94f83fa03f8642fe..ff372151e1b37a235d2c52bb6fa7d8d39d61798e 100644 (file)
@@ -2198,20 +2198,20 @@ With argument ARG, insert value in current buffer after the form."
   (save-excursion
     (end-of-defun)
     (beginning-of-defun)
-    (let* ((print-symbols-bare t)
+    (let* ((print-symbols-bare t)       ; For the final `message'.
            (byte-compile-current-file (current-buffer))
           (byte-compile-current-buffer (current-buffer))
           (start-read-position (point))
           (byte-compile-last-warned-form 'nothing)
+           (symbols-with-pos-enabled t)
           (value (eval
-                  (let ((symbols-with-pos-enabled t))
-                    (displaying-byte-compile-warnings
-                     (byte-compile-sexp
-                       (let ((form (read-positioning-symbols (current-buffer))))
-                         (push form byte-compile-form-stack)
-                         (eval-sexp-add-defvars
-                          form
-                          start-read-position)))))
+                  (displaying-byte-compile-warnings
+                   (byte-compile-sexp
+                     (let ((form (read-positioning-symbols (current-buffer))))
+                       (push form byte-compile-form-stack)
+                       (eval-sexp-add-defvars
+                        form
+                        start-read-position))))
                    lexical-binding)))
       (cond (arg
             (message "Compiling from buffer... done.")