changeset 76483:6f3e13b2e1ce

(command-line-1): Make insertion of initial-scratch-message not depend on scratch being selected.
author Chong Yidong <cyd@stupidchicken.com>
date Sat, 17 Mar 2007 17:59:07 +0000
parents 31e546ba143c
children 4a8569fddcbd
files lisp/startup.el
diffstat 1 files changed, 7 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/startup.el	Sat Mar 17 17:57:38 2007 +0000
+++ b/lisp/startup.el	Sat Mar 17 17:59:07 2007 +0000
@@ -1995,13 +1995,13 @@
     (with-no-warnings
      (setq menubar-bindings-done t))
 
-    ;; If *scratch* is selected and it is empty, insert an
-    ;; initial message saying not to create a file there.
-    (when (and initial-scratch-message
-	       (equal (buffer-name) "*scratch*")
-	       (= 0 (buffer-size)))
-      (insert initial-scratch-message)
-      (set-buffer-modified-p nil))
+    ;; If *scratch* exists and is empty, insert initial-scratch-message.
+    (and initial-scratch-message
+         (get-buffer "*scratch*")
+         (with-current-buffer "*scratch*"
+           (when (zerop (buffer-size))
+             (insert initial-scratch-message)
+             (set-buffer-modified-p nil))))
 
     ;; If user typed input during all that work,
     ;; abort the startup screen.  Otherwise, display it now.