emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

emacs-27 d645628: Always use lexical-binding in lisp-interaction-mode (b


From: Mattias Engdegård
Subject: emacs-27 d645628: Always use lexical-binding in lisp-interaction-mode (bug#38835)
Date: Mon, 13 Jan 2020 13:53:35 -0500 (EST)

branch: emacs-27
commit d645628e3cf6ebe5eaea3b40100bd77b9c823f8b
Author: Mattias Engdegård <address@hidden>
Commit: Mattias Engdegård <address@hidden>

    Always use lexical-binding in lisp-interaction-mode (bug#38835)
    
    * 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   | 3 +++
 etc/NEWS                     | 3 ++-
 lisp/progmodes/elisp-mode.el | 3 ++-
 lisp/startup.el              | 4 +---
 4 files changed, 8 insertions(+), 5 deletions(-)

diff --git a/doc/lispref/variables.texi b/doc/lispref/variables.texi
index 1ec97e2..1e35775 100644
--- a/doc/lispref/variables.texi
+++ b/doc/lispref/variables.texi
@@ -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
diff --git a/etc/NEWS b/etc/NEWS
index 61b9e4a..031ddf5 100644
--- 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
diff --git a/lisp/progmodes/elisp-mode.el b/lisp/progmodes/elisp-mode.el
index 774e332..2617a6e 100644
--- a/lisp/progmodes/elisp-mode.el
+++ b/lisp/progmodes/elisp-mode.el
@@ -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
 
diff --git a/lisp/startup.el b/lisp/startup.el
index c27af72..2a85c00 100644
--- a/lisp/startup.el
+++ b/lisp/startup.el
@@ -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)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]