Subject: bug#30078: 27.0.50; Use lexical-binding for M-:

From: Michael Heerdegen <[email-masked]>
Date: Fri, 12 Jan 2018 18:23:34 +0100

Stefan Monnier <[email-masked]> writes:

>  (defun command-line-1 (args-left)
>    "A subroutine of `command-line'."
>    (display-startup-echo-area-message)
> @@ -2485,7 +2491,7 @@ command-line-1
>      (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.

Don't you also want to change this occurrence in `command-line'?

#+begin_src emacs-lisp
  ;; If *scratch* exists and init file didn't change its mode, initialize it.
  (if (get-buffer "*scratch*")
      (with-current-buffer "*scratch*"
	(if (eq major-mode 'fundamental-mode)
	    (funcall initial-major-mode))))
#+end_src

So far, lexical-binding in *scratch* is nil with emacs -Q with your
patch.

Maybe also check that evaluating the expression `lexical-binding'
returns a result that is consistent with the evaluation behavior.  In
particular, evaluating lexical-binding in M-x ielm RET still gives nil -
that's confusing.

Michael.