From: Paul Eggert Date: Wed, 2 Sep 2015 22:08:03 +0000 (-0700) Subject: Treat initial-scratch-message as a doc string X-Git-Tag: emacs-25.0.90~1225^2~45 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=3d08d06a661344c0ff645e6362e2a2fe1f2e7348;p=emacs.git Treat initial-scratch-message as a doc string * doc/emacs/building.texi (Lisp Interaction): * doc/lispref/os.texi (Startup Summary): * etc/NEWS: Document this. * lisp/startup.el (initial-scratch-message): Look up find-file’s key rather than hardcoding it. (command-line-1): Substitute the doc string. This also substitutes the quotes, which will help test display quoting at startup. --- diff --git a/doc/emacs/building.texi b/doc/emacs/building.texi index b4a99a1c25e..1d40a2dd12d 100644 --- a/doc/emacs/building.texi +++ b/doc/emacs/building.texi @@ -1549,7 +1549,7 @@ mode are the same as in Emacs Lisp mode. At startup, the @file{*scratch*} buffer contains a short message, in the form of a Lisp comment, that explains what it is for. This message is controlled by the variable @code{initial-scratch-message}, -which should be either a string, or @code{nil} (which means to +which should be either a documentation string, or @code{nil} (which means to suppress the message). @findex ielm diff --git a/doc/lispref/os.texi b/doc/lispref/os.texi index 64ebb45f23b..bbe87ca6181 100644 --- a/doc/lispref/os.texi +++ b/doc/lispref/os.texi @@ -195,7 +195,7 @@ It now exits if the option @code{--batch} was specified. @item If the @file{*scratch*} buffer exists and is empty, it inserts -@code{initial-scratch-message} into that buffer. +@code{(substitute-command-keys initial-scratch-message)} into that buffer. @item If @code{initial-buffer-choice} is a string, it visits the file (or @@ -314,6 +314,7 @@ file will not inhibit the message for someone else. @defopt initial-scratch-message This variable, if non-@code{nil}, should be a string, which is +treated as documentation to be inserted into the @file{*scratch*} buffer when Emacs starts up. If it is @code{nil}, the @file{*scratch*} buffer is empty. @end defopt diff --git a/etc/NEWS b/etc/NEWS index c2828c9db51..3e50943c336 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -91,6 +91,10 @@ so if you want to use it, you can always take a copy from an older Emacs. and *Buffer List*. This makes Emacs convenient to use from the command line when `initial-buffer-choice' is non-nil. ++++ +** The value of ‘initial-scratch-message’ is now treated as a doc string +and can contain escape sequences for command keys, quotes, and the like. + * Changes in Emacs 25.1 diff --git a/lisp/startup.el b/lisp/startup.el index c152e0122ae..e0249593893 100644 --- a/lisp/startup.el +++ b/lisp/startup.el @@ -1390,11 +1390,11 @@ settings will be marked as \"CHANGED outside of Customize\"." (defcustom initial-scratch-message (purecopy "\ ;; This buffer is for notes you don't want to save, and for Lisp evaluation. -;; If you want to create a file, visit that file with C-x C-f, +;; If you want to create a file, visit that file with \\[find-file], ;; then enter the text in that file's own buffer. ") - "Initial message displayed in *scratch* buffer at startup. + "Initial documentation displayed in *scratch* buffer at startup. If this is nil, no message will be displayed." :type '(choice (text :tag "Message") (const :tag "none" nil)) @@ -2430,7 +2430,7 @@ nil default-directory" name) (get-buffer "*scratch*") (with-current-buffer "*scratch*" (when (zerop (buffer-size)) - (insert initial-scratch-message) + (insert (substitute-command-keys initial-scratch-message)) (set-buffer-modified-p nil)))) ;; Prepend `initial-buffer-choice' to `displayable-buffers'.