changeset 18392:24c1f9256352

(command-line-1): Don't display startup message if the buffer-is nonempty. Don't make undo entries for it.
author Richard M. Stallman <rms@gnu.org>
date Mon, 23 Jun 1997 00:29:59 +0000
parents 1ff0bfd40508
children f34e9defc58c
files lisp/startup.el
diffstat 1 files changed, 68 insertions(+), 65 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/startup.el	Sun Jun 22 23:08:47 1997 +0000
+++ b/lisp/startup.el	Mon Jun 23 00:29:59 1997 +0000
@@ -735,100 +735,103 @@
 	     (if (memq window-system '(x w32))
 		 (precompute-menubar-bindings))
 	     (setq menubar-bindings-done t)
-	     (unwind-protect
-		 (progn
-		   ;; The convention for this piece of code is that
-		   ;; each piece of output starts with one or two newlines
-		   ;; and does not end with any newlines.
-		   (insert "Welcome to GNU Emacs")
-		   (if (eq system-type 'gnu/linux)
-		       (insert ", one component of a Linux-based GNU system."))
-		   (insert "\n")
-		   ;; If keys have their default meanings,
-		   ;; use precomputed string to save lots of time.
-		   (if (and (eq (key-binding "\C-h") 'help-command)
-			    (eq (key-binding "\C-xu") 'advertised-undo)
-			    (eq (key-binding "\C-x\C-c") 'save-buffers-kill-emacs)
-			    (eq (key-binding "\C-ht") 'help-with-tutorial)
-			    (eq (key-binding "\C-hi") 'info)
-			    (eq (key-binding "\C-h\C-n") 'view-emacs-news))
-		       (insert "
+	     (when (= (buffer-size) 0)
+	       (let ((buffer-undo-list t))
+		 (unwind-protect
+		     (progn
+		       (goto-char (point-max))
+		       ;; The convention for this piece of code is that
+		       ;; each piece of output starts with one or two newlines
+		       ;; and does not end with any newlines.
+		       (insert "Welcome to GNU Emacs")
+		       (if (eq system-type 'gnu/linux)
+			   (insert ", one component of a Linux-based GNU system."))
+		       (insert "\n")
+		       ;; If keys have their default meanings,
+		       ;; use precomputed string to save lots of time.
+		       (if (and (eq (key-binding "\C-h") 'help-command)
+				(eq (key-binding "\C-xu") 'advertised-undo)
+				(eq (key-binding "\C-x\C-c") 'save-buffers-kill-emacs)
+				(eq (key-binding "\C-ht") 'help-with-tutorial)
+				(eq (key-binding "\C-hi") 'info)
+				(eq (key-binding "\C-h\C-n") 'view-emacs-news))
+			   (insert "
 Get help	   C-h  (Hold down CTRL and press h)
 Undo changes	   C-x u       Exit Emacs		C-x C-c
 Get a tutorial	   C-h t       Use Info to read docs	C-h i")
-		     (insert (substitute-command-keys
-			      (format "\n
+			 (insert (substitute-command-keys
+				  (format "\n
 Get help	   %s
 Undo changes	   \\[advertised-undo]
 Exit Emacs	   \\[save-buffers-kill-emacs]
 Get a tutorial	   \\[help-with-tutorial]
 Use Info to read docs	\\[info]"
-				      (let ((where (where-is-internal
-						    'help-command nil t)))
-					(if where
-					    (key-description where)
-					  "M-x help"))))))
-		   ;; Say how to use the menu bar
-		   ;; if that is not with the mouse.
-		   (if (not (assq 'display (frame-parameters)))
-		       (if (and (eq (key-binding "\M-`") 'tmm-menubar)
-				(eq (key-binding [f10]) 'tmm-menubar))
-			   (insert "
+					  (let ((where (where-is-internal
+							'help-command nil t)))
+					    (if where
+						(key-description where)
+					      "M-x help"))))))
+		       ;; Say how to use the menu bar
+		       ;; if that is not with the mouse.
+		       (if (not (assq 'display (frame-parameters)))
+			   (if (and (eq (key-binding "\M-`") 'tmm-menubar)
+				    (eq (key-binding [f10]) 'tmm-menubar))
+			       (insert "
 Activate menubar   F10  or  ESC `  or   M-`")
-			 (insert (substitute-command-keys "
+			     (insert (substitute-command-keys "
 Activate menubar     \\[tmm-menubar]"))))
 
-		   ;; Windows and MSDOS (currently) do not count as
-		   ;; window systems, but do have mouse support.
-		   (if window-system
+		       ;; Windows and MSDOS (currently) do not count as
+		       ;; window systems, but do have mouse support.
+		       (if window-system
+			   (insert "
+Mode-specific menu   C-mouse-3 (third button, with CTRL)"))
+		       ;; Many users seem to have problems with these.
 		       (insert "
-Mode-specific menu   C-mouse-3 (third button, with CTRL)"))
-		   ;; Many users seem to have problems with these.
-		   (insert "
 \(`C-' means use the CTRL key.  `M-' means use the Meta (or Alt) key.
 If you have no Meta key, you may instead type ESC followed by the character.)")
-		   (and auto-save-list-file-prefix
-			(directory-files
-			 (file-name-directory auto-save-list-file-prefix)
-			 nil
-			 (concat "\\`"
-				 (regexp-quote (file-name-nondirectory
-						auto-save-list-file-prefix)))
-			 t)
-			(insert "\n\nIf an Emacs session crashed recently, "
-				"type M-x recover-session RET\nto recover"
-				" the files you were editing."))
+		       (and auto-save-list-file-prefix
+			    (directory-files
+			     (file-name-directory auto-save-list-file-prefix)
+			     nil
+			     (concat "\\`"
+				     (regexp-quote (file-name-nondirectory
+						    auto-save-list-file-prefix)))
+			     t)
+			    (insert "\n\nIf an Emacs session crashed recently, "
+				    "type M-x recover-session RET\nto recover"
+				    " the files you were editing."))
 
-		   (insert "\n\n" (emacs-version)
-			   "
+		       (insert "\n\n" (emacs-version)
+			       "
 Copyright (C) 1996 Free Software Foundation, Inc.")
-		   (if (and (eq (key-binding "\C-h\C-c") 'describe-copying)
-			    (eq (key-binding "\C-h\C-d") 'describe-distribution)
-			    (eq (key-binding "\C-h\C-w") 'describe-no-warranty))
-		       (insert 
-			"\n
+		       (if (and (eq (key-binding "\C-h\C-c") 'describe-copying)
+				(eq (key-binding "\C-h\C-d") 'describe-distribution)
+				(eq (key-binding "\C-h\C-w") 'describe-no-warranty))
+			   (insert 
+			    "\n
 GNU Emacs comes with ABSOLUTELY NO WARRANTY; type C-h C-w for full details.
 You may give out copies of Emacs; type C-h C-c to see the conditions.
 Type C-h C-d for information on getting the latest version.")
-		     (insert (substitute-command-keys
-			      "\n
+			 (insert (substitute-command-keys
+				  "\n
 GNU Emacs comes with ABSOLUTELY NO WARRANTY; type \\[describe-no-warranty] for full details.
 You may give out copies of Emacs; type \\[describe-copying] to see the conditions.
 Type \\[describe-distribution] for information on getting the latest version.")))
-		   (goto-char (point-min))
+		       (goto-char (point-min))
 
-		   (set-buffer-modified-p nil)
-		   (sit-for 120))
-	       (with-current-buffer (get-buffer "*scratch*")
-		 (erase-buffer)
-		 (insert "\
+		       (set-buffer-modified-p nil)
+		       (sit-for 120))
+		   (with-current-buffer (get-buffer "*scratch*")
+		     (erase-buffer)
+		     (insert "\
 If you want to create a file, don't type the text in this buffer.
 This buffer is for notes you don't want to save, and for Lisp evaluation.
 If you want to create a file, first visit that file with C-x C-f,
 then enter the text in that file's own buffer.
 
 ")
-		 (set-buffer-modified-p nil)))))
+		     (set-buffer-modified-p nil)))))))
     ;; Delay 2 seconds after the init file error message
     ;; was displayed, so user can read it.
     (if init-file-had-error