* lisp/startup.el (command-line): Default to lexical-binding in *scratch*.
(normal-no-mouse-startup-screen, command-line-1):
Use startup--get-buffer-create-scratch.
(command-line-1):
* lisp/simple.el (eval-expression):
* lisp/server.el (server-eval-and-print): Use lexical-binding to
evaluate the expression.
(server-execute): Use startup--get-buffer-create-scratch.
* lisp/ielm.el (inferior-emacs-lisp-mode): Default to lexical-binding.
+++
** The function 'read-passwd' uses '*' as default character to hide passwords.
+** 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.
+
---
** The new option 'tooltip-resize-echo-area' avoids truncating tooltip text
on GUI frames when tooltips are displayed in the echo area. Instead,
;; Useful for `hs-minor-mode'.
(setq-local comment-start ";")
(setq-local comment-use-syntax t)
+ (setq-local lexical-binding t)
- (set (make-local-variable 'indent-line-function) 'ielm-indent-line)
+ (set (make-local-variable 'indent-line-function) #'ielm-indent-line)
(set (make-local-variable 'ielm-working-buffer) (current-buffer))
- (set (make-local-variable 'fill-paragraph-function) 'lisp-fill-paragraph)
+ (set (make-local-variable 'fill-paragraph-function) #'lisp-fill-paragraph)
;; Value holders
(set (make-local-variable '*) nil)
;; intended it to interrupt us rather than interrupt whatever Emacs
;; was doing before it started handling the process filter.
;; Hence `with-local-quit' (bug#6585).
- (let ((v (with-local-quit (eval (car (read-from-string expr))))))
+ (let ((v (with-local-quit (eval (car (read-from-string expr)) t))))
(when proc
(with-temp-buffer
(let ((standard-output (current-buffer)))
(find-file-noselect initial-buffer-choice))
((functionp initial-buffer-choice)
(funcall initial-buffer-choice)))))
- (if (buffer-live-p buf) buf (get-buffer-create "*scratch*")))))
+ (if (buffer-live-p buf) buf (startup--get-buffer-create-scratch)))))
;; Set current buffer so that newly created tty frames
;; show the correct buffer initially.
(frame (with-current-buffer (or (car buffers)
(eval-expression-get-print-arguments current-prefix-arg)))
(if (null eval-expression-debug-on-error)
- (push (eval (macroexpand-all exp) lexical-binding) values)
+ (push (eval (let ((lexical-binding t)) (macroexpand-all exp)) t)
+ values))
(let ((old-value (make-symbol "t")) new-value)
;; Bind debug-on-error to something unique so that we can
;; detect when evalled code changes it.
(let ((debug-on-error old-value))
- (push (eval (macroexpand-all exp) lexical-binding) values)
+ (push (eval (let ((lexical-binding t)) (macroexpand-all exp)) t)
+ values)
(setq new-value debug-on-error))
;; If evalled code has changed the value of debug-on-error,
;; propagate that change to the global binding.
(if (get-buffer "*scratch*")
(with-current-buffer "*scratch*"
(if (eq major-mode 'fundamental-mode)
- (funcall initial-major-mode))))
+ (funcall initial-major-mode))
+ (setq-local lexical-binding t)))
;; Load library for our terminal type.
;; User init file can set term-file-prefix to nil to prevent this.
(insert "\t\t")
(insert-button "Open *scratch* buffer"
'action (lambda (_button) (switch-to-buffer
- (get-buffer-create "*scratch*")))
+ (startup--get-buffer-create-scratch)))
'follow-link t)
(insert "\n")
(insert "\n" (emacs-version) "\n" emacs-copyright "\n")
(defalias 'about-emacs 'display-about-screen)
(defalias 'display-splash-screen 'display-startup-screen)
+(defun startup--get-buffer-create-scratch ()
+ (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)
"A subroutine of `command-line'."
(display-startup-echo-area-message)
(unless (= end (length str-expr))
(error "Trailing garbage following expression: %s"
(substring str-expr end)))
- (eval expr)))
+ (eval expr t)))
((member argi '("-L" "-directory"))
;; -L :/foo adds /foo to the _end_ of load-path.
(when (eq initial-buffer-choice t)
;; When `initial-buffer-choice' equals t make sure that *scratch*
;; exists.
- (get-buffer-create "*scratch*"))
+ (startup--get-buffer-create-scratch))
;; If *scratch* exists and is empty, insert initial-scratch-message.
;; Do this before switching to *scratch* below to handle bug#9605.
((functionp initial-buffer-choice)
(funcall initial-buffer-choice))
((eq initial-buffer-choice t)
- (get-buffer-create "*scratch*"))
+ (startup--get-buffer-create-scratch))
(t
(error "`initial-buffer-choice' must be a string, a function, or t")))))
(unless (buffer-live-p buf)