Spelling fixes.
[bpt/emacs.git] / lisp / startup.el
index 3285d47..06911e0 100644 (file)
@@ -41,8 +41,9 @@
 (defcustom initial-buffer-choice nil
   "Buffer to show after starting Emacs.
 If the value is nil and `inhibit-startup-screen' is nil, show the
-startup screen.  If the value is string, visit the specified file or
-directory using `find-file'.  If t, open the `*scratch*' buffer."
+startup screen.  If the value is string, visit the specified file
+or directory using `find-file'.  If t, open the `*scratch*'
+buffer."
   :type '(choice
          (const     :tag "Startup screen" nil)
          (directory :tag "Directory" :value "~/")
@@ -104,6 +105,11 @@ This is a convenience alias, so that one can write \(pop argv\)
 inside of --eval command line arguments in order to access
 following arguments.")
 
+(with-no-warnings
+  ;; FIXME: Bad name for a dynamically bound variable
+  (defvar argi nil
+    "Current command-line argument."))
+
 (defvar command-line-functions nil    ;; lrs 7/31/89
   "List of functions to process unrecognized command-line arguments.
 Each function should access the dynamically bound variables
@@ -403,7 +409,7 @@ The regexp should not contain a starting \"\\`\" or a trailing
  \"\\'\"; those are added automatically by callers.")
 
 (defun normal-top-level-add-subdirs-to-load-path ()
-  "Add all subdirectories of current directory to `load-path'.
+  "Add all subdirectories of `default-directory' to `load-path'.
 More precisely, this uses only the subdirectories whose names
 start with letters or digits; it excludes any subdirectory named `RCS'
 or `CVS', and any subdirectory that contains a file named `.nosearch'."
@@ -937,7 +943,7 @@ opening the first frame (e.g. open a connection to an X server).")
   (normal-erase-is-backspace-setup-frame)
 
   ;; Register default TTY colors for the case the terminal hasn't a
-  ;; terminal init file.  We do this regardles of whether the terminal
+  ;; terminal init file.  We do this regardless of whether the terminal
   ;; supports colors or not and regardless the current display type,
   ;; since users can connect to color-capable terminals and also
   ;; switch color support on or off in mid-session by setting the
@@ -1027,10 +1033,9 @@ opening the first frame (e.g. open a connection to an X server).")
                              "~/.emacs")
                             ((directory-files "~" nil "^_emacs\\(\\.elc?\\)?$")
                              ;; Also support _emacs for compatibility, but warn about it.
-                             (display-warning
-                              'initialization
-                              "`_emacs' init file is deprecated, please use `.emacs'"
-                              :warning)
+                             (push '(initialization
+                                     "`_emacs' init file is deprecated, please use `.emacs'")
+                                   delayed-warnings-list)
                              "~/_emacs")
                             (t ;; But default to .emacs if _emacs does not exist.
                              "~/.emacs"))))
@@ -1127,7 +1132,7 @@ the `--debug-init' option to view a complete error backtrace."
                  (eq orig-enable-multibyte (default-value
                                              'enable-multibyte-characters)))
        ;; Init file changed to unibyte.  Reset existing multibyte
-       ;; buffers (probably *scratch*, *Messages*, *Minibuff-0*).
+       ;; buffers (probably *scratch*, *Messages*, *Minibuf-0*).
        ;; Arguably this should only be done if they're free of
        ;; multibyte characters.
        (mapc (lambda (buffer)
@@ -1294,7 +1299,7 @@ If this is nil, no message will be displayed."
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 
 (defconst fancy-startup-text
-  `((:face (variable-pitch (:foreground "red"))
+  `((:face (variable-pitch font-lock-comment-face)
      "Welcome to "
      :link ("GNU Emacs"
            ,(lambda (_button) (browse-url "http://www.gnu.org/software/emacs/"))
@@ -1351,7 +1356,7 @@ Each element in the list should be a list of strings or pairs
 `:face FACE', like `fancy-splash-insert' accepts them.")
 
 (defconst fancy-about-text
-  `((:face (variable-pitch (:foreground "red"))
+  `((:face (variable-pitch font-lock-comment-face)
      "This is "
      :link ("GNU Emacs"
            ,(lambda (_button) (browse-url "http://www.gnu.org/software/emacs/"))
@@ -1367,11 +1372,7 @@ Each element in the list should be a list of strings or pairs
         `("GNU" ,(lambda (_button) (describe-gnu-project))
           "Display info on the GNU project.")))
      " operating system.\n"
-     :face ,(lambda ()
-            (list 'variable-pitch
-                  (list :foreground
-                        (if (eq (frame-parameter nil 'background-mode) 'dark)
-                            "cyan" "darkblue"))))
+     :face (variable-pitch font-lock-builtin-face)
      "\n"
      ,(lambda () (emacs-version))
      "\n"
@@ -1427,8 +1428,7 @@ Each element in the list should be a list of strings or pairs
            ,(lambda (_button)
                (browse-url "http://www.gnu.org/software/emacs/tour/"))
            "Browse http://www.gnu.org/software/emacs/tour/")
-     "\tSee an overview of Emacs features at gnu.org"
-     ))
+     "\tSee an overview of Emacs features at gnu.org"))
   "A list of texts to show in the middle part of the About screen.
 Each element in the list should be a list of strings or pairs
 `:face FACE', like `fancy-splash-insert' accepts them.")
@@ -1450,8 +1450,8 @@ Each element in the list should be a list of strings or pairs
   (let ((map (make-sparse-keymap)))
     (suppress-keymap map)
     (set-keymap-parent map button-buffer-map)
-    (define-key map "\C-?" 'scroll-down)
-    (define-key map " " 'scroll-up)
+    (define-key map "\C-?" 'scroll-down-command)
+    (define-key map " " 'scroll-up-command)
     (define-key map "q" 'exit-splash-screen)
     map)
   "Keymap for splash screen buffer.")
@@ -1538,93 +1538,91 @@ a face or button specification."
 
 (defun fancy-startup-tail (&optional concise)
   "Insert the tail part of the splash screen into the current buffer."
-  (let ((fg (if (eq (frame-parameter nil 'background-mode) 'dark)
-               "cyan" "darkblue")))
-    (unless concise
-      (fancy-splash-insert
-       :face 'variable-pitch
-       "\nTo start...     "
-       :link `("Open a File"
-              ,(lambda (_button) (call-interactively 'find-file))
-              "Specify a new file's name, to edit the file")
-       "     "
-       :link `("Open Home Directory"
-              ,(lambda (_button) (dired "~"))
-              "Open your home directory, to operate on its files")
-       "     "
-       :link `("Customize Startup"
-              ,(lambda (_button) (customize-group 'initialization))
-              "Change initialization settings including this screen")
-       "\n"))
+  (unless concise
+    (fancy-splash-insert
+     :face 'variable-pitch
+     "\nTo start...     "
+     :link `("Open a File"
+            ,(lambda (_button) (call-interactively 'find-file))
+            "Specify a new file's name, to edit the file")
+     "     "
+     :link `("Open Home Directory"
+            ,(lambda (_button) (dired "~"))
+            "Open your home directory, to operate on its files")
+     "     "
+     :link `("Customize Startup"
+            ,(lambda (_button) (customize-group 'initialization))
+            "Change initialization settings including this screen")
+     "\n"))
+  (fancy-splash-insert
+   :face 'variable-pitch "To quit a partially entered command, type "
+   :face 'default "Control-g"
+   :face 'variable-pitch ".\n")
+  (fancy-splash-insert :face `(variable-pitch font-lock-builtin-face)
+                      "\nThis is "
+                      (emacs-version)
+                      "\n"
+                      :face '(variable-pitch (:height 0.8))
+                      emacs-copyright
+                      "\n")
+  (and auto-save-list-file-prefix
+       ;; Don't signal an error if the
+       ;; directory for auto-save-list files
+       ;; does not yet exist.
+       (file-directory-p (file-name-directory
+                         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)
+       (fancy-splash-insert :face '(variable-pitch font-lock-comment-face)
+                           "\nIf an Emacs session crashed recently, "
+                           "type "
+                           :face '(fixed-pitch font-lock-comment-face)
+                           "Meta-x recover-session RET"
+                           :face '(variable-pitch font-lock-comment-face)
+                           "\nto recover"
+                           " the files you were editing."))
+
+  (when concise
     (fancy-splash-insert
-     :face 'variable-pitch "To quit a partially entered command, type "
-     :face 'default "Control-g"
-     :face 'variable-pitch ".\n")
-    (fancy-splash-insert :face `(variable-pitch (:foreground ,fg))
-                        "\nThis is "
-                        (emacs-version)
-                        "\n"
-                        :face '(variable-pitch (:height 0.8))
-                        emacs-copyright
-                        "\n")
-    (and auto-save-list-file-prefix
-        ;; Don't signal an error if the
-        ;; directory for auto-save-list files
-        ;; does not yet exist.
-        (file-directory-p (file-name-directory
-                           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)
-        (fancy-splash-insert :face '(variable-pitch (:foreground "red"))
-                             "\nIf an Emacs session crashed recently, "
-                             "type "
-                             :face '(fixed-pitch :foreground "red")
-                             "Meta-x recover-session RET"
-                             :face '(variable-pitch (:foreground "red"))
-                             "\nto recover"
-                             " the files you were editing."))
-
-    (when concise
-      (fancy-splash-insert
-       :face 'variable-pitch "\n"
-       :link `("Dismiss this startup screen"
-              ,(lambda (_button)
-                  (when startup-screen-inhibit-startup-screen
-                    (customize-set-variable 'inhibit-startup-screen t)
-                    (customize-mark-to-save 'inhibit-startup-screen)
-                    (custom-save-all))
-                  (let ((w (get-buffer-window "*GNU Emacs*")))
-                    (and w (not (one-window-p)) (delete-window w)))
-                  (kill-buffer "*GNU Emacs*")))
-       "  ")
-      (when (or user-init-file custom-file)
-       (let ((checked (create-image "checked.xpm"
-                                    nil nil :ascent 'center))
-             (unchecked (create-image "unchecked.xpm"
-                                      nil nil :ascent 'center)))
-         (insert-button
-          " "
-          :on-glyph checked
-          :off-glyph unchecked
-          'checked nil 'display unchecked 'follow-link t
-          'action (lambda (button)
-                    (if (overlay-get button 'checked)
-                        (progn (overlay-put button 'checked nil)
-                               (overlay-put button 'display
-                                            (overlay-get button :off-glyph))
-                               (setq startup-screen-inhibit-startup-screen
-                                     nil))
-                      (overlay-put button 'checked t)
-                      (overlay-put button 'display
-                                   (overlay-get button :on-glyph))
-                      (setq startup-screen-inhibit-startup-screen t)))))
-       (fancy-splash-insert :face '(variable-pitch (:height 0.9))
-                            " Never show it again.")))))
+     :face 'variable-pitch "\n"
+     :link `("Dismiss this startup screen"
+            ,(lambda (_button)
+               (when startup-screen-inhibit-startup-screen
+                 (customize-set-variable 'inhibit-startup-screen t)
+                 (customize-mark-to-save 'inhibit-startup-screen)
+                 (custom-save-all))
+               (let ((w (get-buffer-window "*GNU Emacs*")))
+                 (and w (not (one-window-p)) (delete-window w)))
+               (kill-buffer "*GNU Emacs*")))
+     "  ")
+    (when (or user-init-file custom-file)
+      (let ((checked (create-image "checked.xpm"
+                                  nil nil :ascent 'center))
+           (unchecked (create-image "unchecked.xpm"
+                                    nil nil :ascent 'center)))
+       (insert-button
+        " "
+        :on-glyph checked
+        :off-glyph unchecked
+        'checked nil 'display unchecked 'follow-link t
+        'action (lambda (button)
+                  (if (overlay-get button 'checked)
+                      (progn (overlay-put button 'checked nil)
+                             (overlay-put button 'display
+                                          (overlay-get button :off-glyph))
+                             (setq startup-screen-inhibit-startup-screen
+                                   nil))
+                    (overlay-put button 'checked t)
+                    (overlay-put button 'display
+                                 (overlay-get button :on-glyph))
+                    (setq startup-screen-inhibit-startup-screen t)))))
+      (fancy-splash-insert :face '(variable-pitch (:height 0.9))
+                          " Never show it again."))))
 
 (defun exit-splash-screen ()
   "Stop displaying the splash screen buffer."
@@ -1677,11 +1675,7 @@ splash screen in another window."
     (save-selected-window
       (select-frame frame)
       (switch-to-buffer "*About GNU Emacs*")
-      (setq buffer-undo-list t
-           mode-line-format
-           (concat "----"
-                   (propertize "%b" 'face 'mode-line-buffer-id)
-                   "%-"))
+      (setq buffer-undo-list t)
       (let ((inhibit-read-only t))
        (erase-buffer)
        (if pure-space-overflow
@@ -1744,9 +1738,6 @@ splash screen in another window."
       (erase-buffer)
       (setq default-directory command-line-default-directory)
       (set (make-local-variable 'tab-width) 8)
-      (if (not startup)
-         (set (make-local-variable 'mode-line-format)
-              (propertize "---- %b %-" 'face 'mode-line-buffer-id)))
 
       (if pure-space-overflow
          (insert pure-space-overflow-message))
@@ -2316,13 +2307,13 @@ A fancy display is used on graphic displays, normal otherwise."
            ;; abort later.
            (unless (frame-live-p (selected-frame)) (kill-emacs nil))))))
 
-    (when initial-buffer-choice
-      (cond ((eq initial-buffer-choice t)
-            (switch-to-buffer (get-buffer-create "*scratch*")))
-           ((stringp initial-buffer-choice)
-            (find-file initial-buffer-choice))))
+    (when (eq initial-buffer-choice t)
+      ;; When initial-buffer-choice equals t make sure that *scratch*
+      ;; exists.
+      (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.
     (and initial-scratch-message
         (get-buffer "*scratch*")
         (with-current-buffer "*scratch*"
@@ -2330,6 +2321,12 @@ A fancy display is used on graphic displays, normal otherwise."
             (insert initial-scratch-message)
             (set-buffer-modified-p nil))))
 
+    (when initial-buffer-choice
+      (cond ((eq initial-buffer-choice t)
+            (switch-to-buffer (get-buffer-create "*scratch*")))
+           ((stringp initial-buffer-choice)
+            (find-file initial-buffer-choice))))
+
     (if (or inhibit-startup-screen
            initial-buffer-choice
            noninteractive