]> code.delx.au - gnu-emacs/commitdiff
(command-line-1): Make insertion of initial-scratch-message not depend
authorChong Yidong <cyd@stupidchicken.com>
Sat, 17 Mar 2007 17:59:07 +0000 (17:59 +0000)
committerChong Yidong <cyd@stupidchicken.com>
Sat, 17 Mar 2007 17:59:07 +0000 (17:59 +0000)
on scratch being selected.

lisp/startup.el

index 9192222ec883795c5360b24c5fa2f698e54a145c..7e6b4f9ac36edde60f7678576f78b705aef1bff6 100644 (file)
@@ -1995,13 +1995,13 @@ With a prefix argument, any user input hides the splash screen."
     (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.