]> code.delx.au - gnu-emacs/blobdiff - lisp/startup.el
Merged from emacs@sv.gnu.org
[gnu-emacs] / lisp / startup.el
index 533f9dbeaaead0e961589da02aa375ed2a1e0f2a..a4197a8550231d6e53f2f74607aa74d4c7ab6c9a 100644 (file)
@@ -1,7 +1,7 @@
 ;;; startup.el --- process Emacs shell arguments
 
 ;; Copyright (C) 1985, 1986, 1992, 1994, 1995, 1996, 1997, 1998, 1999, 2000,
-;;   2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
+;;   2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
 
 ;; Maintainer: FSF
 ;; Keywords: internal
@@ -48,7 +48,9 @@ The value is nil if the selected frame is on a text-only-terminal.")
   :group 'internal)
 
 (defcustom inhibit-splash-screen nil
-  "*Non-nil inhibits the startup screen.
+  "Non-nil inhibits the startup screen.
+It also inhibits display of the initial message in the *scratch* buffer.
+
 This is for use in your personal init file, once you are familiar
 with the contents of the startup screen."
   :type 'boolean
@@ -204,23 +206,22 @@ the user's init file.")
   :type 'function
   :group 'initialization)
 
-(defcustom init-file-user nil
+(defvar init-file-user nil
   "Identity of user whose `.emacs' file is or was read.
 The value is nil if `-q' or `--no-init-file' was specified,
 meaning do not load any init file.
 
-Otherwise, the value may be the null string, meaning use the init file
-for the user that originally logged in, or it may be a
-string containing a user's name meaning use that person's init file.
+Otherwise, the value may be an empty string, meaning
+use the init file for the user who originally logged in,
+or it may be a string containing a user's name meaning
+use that person's init file.
 
 In either of the latter cases, `(concat \"~\" init-file-user \"/\")'
 evaluates to the name of the directory where the `.emacs' file was
 looked for.
 
 Setting `init-file-user' does not prevent Emacs from loading
-`site-start.el'.  The only way to do that is to use `--no-site-file'."
-  :type '(choice (const :tag "none" nil) string)
-  :group 'initialization)
+`site-start.el'.  The only way to do that is to use `--no-site-file'.")
 
 (defcustom site-run-file "site-start"
   "File containing site-wide run-time initializations.
@@ -781,6 +782,7 @@ opening the first frame (e.g. open a connection to an X server).")
   (custom-reevaluate-setting 'mouse-wheel-down-event)
   (custom-reevaluate-setting 'mouse-wheel-up-event)
   (custom-reevaluate-setting 'file-name-shadow-mode)
+  (custom-reevaluate-setting 'send-mail-function)
 
   (normal-erase-is-backspace-setup-frame)
 
@@ -1071,7 +1073,9 @@ opening the first frame (e.g. open a connection to an X server).")
 
 ")
   "Initial message displayed in *scratch* buffer at startup.
-If this is nil, no message will be displayed."
+If this is nil, no message will be displayed.
+If `inhibit-splash-screen' is non-nil, then no message is displayed,
+regardless of the value of this variable."
   :type '(choice (text :tag "Message")
                 (const :tag "none" nil))
   :group 'initialization)
@@ -1249,7 +1253,7 @@ where FACE is a valid face specification, as it can be used with
                         (emacs-version)
                         "\n"
                         :face '(variable-pitch :height 0.5)
-                        "Copyright (C) 2005 Free Software Foundation, Inc.")
+                        "Copyright (C) 2006 Free Software Foundation, Inc.")
     (and auto-save-list-file-prefix
         ;; Don't signal an error if the
         ;; directory for auto-save-list files
@@ -1289,7 +1293,6 @@ where FACE is a valid face specification, as it can be used with
     (force-mode-line-update)
     (setq fancy-current-text (cdr fancy-current-text))))
 
-
 (defun fancy-splash-default-action ()
   "Stop displaying the splash screen buffer.
 This is an internal function used to turn off the splash screen after
@@ -1299,12 +1302,23 @@ mouse."
   (if (and (memq 'down (event-modifiers last-command-event))
           (eq (posn-window (event-start last-command-event))
               (selected-window)))
-      ;; This is a mouse-down event in the spash screen window.
+      ;; This is a mouse-down event in the splash screen window.
       ;; Ignore it and consume the corresponding mouse-up event.
       (read-event)
     (push last-command-event unread-command-events))
   (throw 'exit nil))
 
+(defun fancy-splash-exit ()
+  "Exit the splash screen."
+  (if (get-buffer "GNU Emacs")
+      (throw 'stop-splashing nil)))
+
+(defun fancy-splash-delete-frame (frame)
+  "Exit the splash screen after the frame is deleted."
+  ;; We can not throw from `delete-frame-events', so we set up a timer
+  ;; to exit the recursive edit as soon as Emacs is idle again.
+  (if (frame-live-p frame)
+      (run-at-time 0 nil 'fancy-splash-exit)))
 
 (defun fancy-splash-screens ()
   "Display fancy splash screens when Emacs starts."
@@ -1322,12 +1336,17 @@ mouse."
       (setq splash-buffer (current-buffer))
       (catch 'stop-splashing
        (unwind-protect
-           (let ((map (make-sparse-keymap)))
-             (use-local-map map)
-             (define-key map [switch-frame] 'ignore)
+           (let* ((map (make-sparse-keymap))
+                  (overriding-local-map map)
+                  ;; Catch if our frame is deleted; the delete-frame
+                  ;; event is unreliable and is handled by
+                  ;; `special-event-map' anyway.
+                  (delete-frame-functions (cons 'fancy-splash-delete-frame
+                                                delete-frame-functions)))
              (define-key map [t] 'fancy-splash-default-action)
              (define-key map [mouse-movement] 'ignore)
              (define-key map [mode-line t] 'ignore)
+             (define-key map [select-window] 'ignore)
              (setq cursor-type nil
                    display-hourglass nil
                    minor-mode-map-alist nil
@@ -1343,7 +1362,10 @@ mouse."
          (cancel-timer timer)
          (setq display-hourglass old-hourglass
                minor-mode-map-alist old-minor-mode-map-alist)
-         (kill-buffer splash-buffer))))))
+         (kill-buffer splash-buffer)
+         (when (frame-live-p frame)
+           (select-frame frame)
+           (switch-to-buffer fancy-splash-outer-buffer)))))))
 
 (defun fancy-splash-frame ()
   "Return the frame to use for the fancy splash screen.
@@ -1379,10 +1401,9 @@ we put it on this frame."
   (let ((prev-buffer (current-buffer)))
     (unwind-protect
        (with-current-buffer (get-buffer-create "GNU Emacs")
-         (let ((tab-width 8)
-               (mode-line-format (propertize "---- %b %-"
-                                             'face '(:weight bold))))
-
+         (setq mode-line-format (propertize "---- %b %-"
+                                            'face '(:weight bold)))
+         (let ((tab-width 8))
            (if pure-space-overflow
                (insert "Warning Warning  Pure space overflow   Warning Warning\n"))
 
@@ -1421,7 +1442,7 @@ More Manuals / Ordering Manuals    How to order printed manuals from the FSF
 ")
                  (insert "\n\n" (emacs-version)
                          "
-Copyright (C) 2005 Free Software Foundation, Inc."))
+Copyright (C) 2006 Free Software Foundation, Inc."))
 
              ;; No mouse menus, so give help using kbd commands.
 
@@ -1429,7 +1450,7 @@ Copyright (C) 2005 Free Software Foundation, Inc."))
              ;; 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-display)
+                      (eq (key-binding "\C-x\C-c") 'save-buffers-kill-terminal)
                       (eq (key-binding "\C-ht") 'help-with-tutorial)
                       (eq (key-binding "\C-hi") 'info)
                       (eq (key-binding "\C-hr") 'info-emacs-manual)
@@ -1446,7 +1467,7 @@ Browse manuals     C-h i")
 Get help          %s
 Emacs manual      \\[info-emacs-manual]
 Emacs tutorial    \\[help-with-tutorial]\tUndo changes\t\\[advertised-undo]
-Buy manuals        \\[view-order-manuals]\tExit Emacs\t\\[save-buffers-kill-display]
+Buy manuals        \\[view-order-manuals]\tExit Emacs\t\\[save-buffers-kill-terminal]
 Browse manuals     \\[info]"
                                 (let ((where (where-is-internal
                                               'help-command nil t)))
@@ -1469,7 +1490,7 @@ If you have no Meta key, you may instead type ESC followed by the character.)")
 
              (insert "\n\n" (emacs-version)
                      "
-Copyright (C) 2005 Free Software Foundation, Inc.")
+Copyright (C) 2006 Free Software Foundation, Inc.")
 
              (if (and (eq (key-binding "\C-h\C-c") 'describe-copying)
                       (eq (key-binding "\C-h\C-d") 'describe-distribution)
@@ -1536,10 +1557,11 @@ Type \\[describe-distribution] for information on getting the latest version."))
 Fancy splash screens are used on graphic displays,
 normal otherwise."
   (interactive)
-  (if (use-fancy-splash-screens-p)
-      (fancy-splash-screens)
-    (normal-splash-screen)))
-
+  ;; Prevent recursive calls from server-process-filter.
+  (if (not (get-buffer "GNU Emacs"))
+      (if (use-fancy-splash-screens-p)
+         (fancy-splash-screens)
+       (normal-splash-screen))))
 
 (defun command-line-1 (command-line-args-left)
   (or noninteractive (input-pending-p) init-file-had-error
@@ -1612,7 +1634,7 @@ normal otherwise."
           (longopts
            (append '(("--funcall") ("--load") ("--insert") ("--kill")
                      ("--directory") ("--eval") ("--execute") ("--no-splash")
-                     ("--find-file") ("--visit") ("--file"))
+                     ("--find-file") ("--visit") ("--file") ("--no-desktop"))
                    (mapcar (lambda (elt)
                              (list (concat "-" (car elt))))
                            command-switch-alist)))
@@ -1712,6 +1734,13 @@ normal otherwise."
                 ((equal argi "-kill")
                  (kill-emacs t))
 
+               ;; This is for when they use --no-desktop with -q, or
+               ;; don't load Desktop in their .emacs.  If desktop.el
+               ;; _is_ loaded, it will handle this switch, and we
+               ;; won't see it by the time we get here.
+               ((equal argi "-no-desktop")
+                (message "\"--no-desktop\" ignored because the Desktop package is not loaded"))
+
                 ((string-match "^\\+[0-9]+\\'" argi)
                  (setq line (string-to-number argi)))