]> git.eshelyaron.com Git - emacs.git/commitdiff
Always use lexical-binding in lisp-interaction-mode (bug#38835)
authorMattias Engdegård <mattiase@acm.org>
Mon, 13 Jan 2020 13:53:11 +0000 (14:53 +0100)
committerMattias Engdegård <mattiase@acm.org>
Mon, 13 Jan 2020 17:03:41 +0000 (18:03 +0100)
* lisp/progmodes/elisp-mode.el (lisp-interaction-mode):
Set lexical-binding.
* lisp/startup.el (command-line, startup--get-buffer-create-scratch):
Don't set lexical-binding here.
* doc/lispref/variables.texi:
* etc/NEWS:
Make it clear that lisp-interaction-mode uses lexical-binding.

doc/lispref/variables.texi
etc/NEWS
lisp/progmodes/elisp-mode.el
lisp/startup.el

index 1ec97e2f3de0d68466885d783912d6696613740e..1e357754abe04069ace0bc804655cd7066447cf5 100644 (file)
@@ -1187,6 +1187,9 @@ When evaluating Emacs Lisp code directly using an @code{eval} call,
 lexical binding is enabled if the @var{lexical} argument to
 @code{eval} is non-@code{nil}.  @xref{Eval}.
 
+Lexical binding is also enabled in Lisp Interaction and IELM
+mode, used in the @file{*scratch*} and @file{*ielm*} buffers.
+
 @cindex special variables
   Even when lexical binding is enabled, certain variables will
 continue to be dynamically bound.  These are called @dfn{special
index 61b9e4a7237d827d1f54f64e09a952d6810d5c34..031ddf58005ac3725d57fa52b9e82e58cfa51ca9 100644 (file)
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -338,7 +338,8 @@ answers, but also function keys like 'F1', character events such as
 
 ** Lexical binding is now used when evaluating interactive Elisp forms.
 More specifically, lexical-binding is now used for 'M-:', '--eval', as
-well as in the "*scratch*" and "*ielm*" buffers.
+well as in lisp-interaction-mode and ielm-mode, used in the "*scratch*"
+and "*ielm*" buffers.
 
 ---
 ** The new user option 'tooltip-resize-echo-area' avoids truncating
index 774e3324c2e39fdd3bd68eea35fd2d9f1a500c8d..2617a6e4cce3cec0a4ab0f53ce7406ce006dc949 100644 (file)
@@ -933,7 +933,8 @@ Paragraphs are separated only by blank lines.
 Semicolons start comments.
 
 \\{lisp-interaction-mode-map}"
-  :abbrev-table nil)
+  :abbrev-table nil
+  (setq-local lexical-binding t))
 
 ;;; Emacs Lisp Byte-Code mode
 
index c27af726f9c0ae66d445376a48bbc308ba15d538..2a85c004da124a83b3107f5a23a7a60bb4150d5c 100644 (file)
@@ -1435,8 +1435,7 @@ please check its value")
   (if (get-buffer "*scratch*")
       (with-current-buffer "*scratch*"
        (if (eq major-mode 'fundamental-mode)
-           (funcall initial-major-mode))
-        (setq-local lexical-binding t)))
+           (funcall initial-major-mode))))
 
   ;; Load library for our terminal type.
   ;; User init file can set term-file-prefix to nil to prevent this.
@@ -2317,7 +2316,6 @@ A fancy display is used on graphic displays, normal otherwise."
   (or (get-buffer "*scratch*")
       (with-current-buffer (get-buffer-create "*scratch*")
         (set-buffer-major-mode (current-buffer))
-        (setq-local lexical-binding t)
         (current-buffer))))
 
 (defun command-line-1 (args-left)