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.
This commit is contained in:
Mattias Engdegård 2020-01-13 14:53:11 +01:00
parent c42198f78c
commit d645628e3c
4 changed files with 8 additions and 5 deletions

View 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

View file

@ -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

View 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

View 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)