]> code.delx.au - gnu-emacs/blobdiff - lisp/startup.el
(command-line): Whitespace change.
[gnu-emacs] / lisp / startup.el
index 790d8704c299a272c6d6046a461fc0f50ea89c06..2a91f9d3901e9b6a7121fbe9bd2fe00177297a2f 100644 (file)
@@ -1,7 +1,7 @@
 ;;; startup.el --- process Emacs shell arguments
 
-;; Copyright (C) 1985, 86, 92, 94, 95, 96, 97, 98, 99, 2000, 01, 02, 2004
-;;   Free Software Foundation, Inc.
+;; Copyright (C) 1985, 1986, 1992, 1994, 1995, 1996, 1997, 1998, 1999, 2000,
+;;   2001, 2002, 2004, 2005  Free Software Foundation, Inc.
 
 ;; Maintainer: FSF
 ;; Keywords: internal
@@ -277,12 +277,16 @@ from being initialized."
 
 (defvar emacs-quick-startup nil)
 
+(defvar emacs-basic-display nil)
+
 (defvar init-file-debug nil)
 
 (defvar init-file-had-error nil)
 
 (defvar normal-top-level-add-subdirs-inode-list nil)
 
+(defvar no-blinking-cursor nil)
+
 (defvar pure-space-overflow nil
   "Non-nil if building Emacs overflowed pure space.")
 
@@ -563,22 +567,9 @@ or `CVS', and any subdirectory that contains a file named `.nosearch'."
   (setq command-line-default-directory default-directory)
 
   ;; Choose a reasonable location for temporary files.
-  (setq temporary-file-directory
-       (file-name-as-directory
-        (cond ((memq system-type '(ms-dos windows-nt))
-               (or (getenv "TEMP") (getenv "TMPDIR") (getenv "TMP") "c:/temp"))
-              ((memq system-type '(vax-vms axp-vms))
-               (or (getenv "TMPDIR") (getenv "TMP") (getenv "TEMP") "SYS$SCRATCH:"))
-              (t
-               (or (getenv "TMPDIR") (getenv "TMP") (getenv "TEMP") "/tmp")))))
-  (setq small-temporary-file-directory
-       (if (eq system-type 'ms-dos)
-           (getenv "TMPDIR")))
-  (setq auto-save-file-name-transforms
-       (list (list (car (car auto-save-file-name-transforms))
-                   ;; Don't put "\\2" inside expand-file-name, since
-                   ;; it will be transformed to "/2" on DOS/Windows.
-                   (concat temporary-file-directory "\\2") t)))
+  (custom-reevaluate-setting 'temporary-file-directory)
+  (custom-reevaluate-setting 'small-emporary-file-directory)
+  (custom-reevaluate-setting 'auto-save-file-name-transforms)
 
   ;; See if we should import version-control from the environment variable.
   (let ((vc (getenv "VERSION_CONTROL")))
@@ -667,7 +658,8 @@ or `CVS', and any subdirectory that contains a file named `.nosearch'."
     ;; does things.
     (while (and (not done) args)
       (let* ((longopts '(("--no-init-file") ("--no-site-file") ("--user")
-                         ("--debug-init") ("--iconic") ("--icon-type")))
+                         ("--debug-init") ("--iconic") ("--icon-type")
+                        ("--no-blinking-cursor") ("--bare-bones")))
              (argi (pop args))
              (orig-argi argi)
              argval)
@@ -687,10 +679,13 @@ or `CVS', and any subdirectory that contains a file named `.nosearch'."
                (setq argval nil
                       argi orig-argi)))))
        (cond
-        ((equal argi "-Q")
+        ((member argi '("-Q" "-quick"))
          (setq init-file-user nil
                site-run-file nil
-               emacs-quick-startup t)
+               emacs-quick-startup t))
+        ((member argi '("-D" "-basic-display"))
+         (setq no-blinking-cursor t
+               emacs-basic-display t)
          (push '(vertical-scroll-bars . nil) initial-frame-alist))
         ((member argi '("-q" "-no-init-file"))
          (setq init-file-user nil))
@@ -705,6 +700,8 @@ or `CVS', and any subdirectory that contains a file named `.nosearch'."
          (push '(visibility . icon) initial-frame-alist))
         ((member argi '("-icon-type" "-i" "-itype"))
          (push '(icon-type . t) default-frame-alist))
+        ((member argi '("-nbc" "-no-blinking-cursor"))
+         (setq no-blinking-cursor t))
         ;; Push the popped arg back on the list of arguments.
         (t
           (push argi args)
@@ -717,56 +714,54 @@ or `CVS', and any subdirectory that contains a file named `.nosearch'."
     (and command-line-args
          (setcdr command-line-args args)))
 
-  ;; Under X Windows, this creates the X frame and deletes the terminal frame.
+  ;; Under X Window, this creates the X frame and deletes the terminal frame.
   (when (fboundp 'frame-initialize)
     (frame-initialize))
 
+  ;; Turn off blinking cursor if so specified in X resources.  This is here
+  ;; only because all other settings of no-blinking-cursor is here.
+  (unless (or noninteractive
+             emacs-basic-display
+             (and (memq window-system '(x w32 mac))
+                  (not (member (x-get-resource "cursorBlink" "CursorBlink")
+                               '("off" "false")))))
+    (setq no-blinking-cursor t))
+
   ;; If frame was created with a menu bar, set menu-bar-mode on.
   (unless (or noninteractive
-             emacs-quick-startup
+             emacs-basic-display
               (and (memq window-system '(x w32))
                    (<= (frame-parameter nil 'menu-bar-lines) 0)))
     (menu-bar-mode 1))
 
   ;; If frame was created with a tool bar, switch tool-bar-mode on.
   (unless (or noninteractive
-             emacs-quick-startup
+             emacs-basic-display
               (not (display-graphic-p))
               (<= (frame-parameter nil 'tool-bar-lines) 0))
     (tool-bar-mode 1))
 
   ;; Can't do this init in defcustom because the relevant variables
-  ;; are not set.  If you make any changes to the `or' form below,
-  ;; you should also change the corresponding expression in the
-  ;; defcustom in frame.el, or Custom will be badly confused.
-  (unless (or noninteractive
-             emacs-quick-startup
-              (eq system-type 'ms-dos)
-              (not (memq window-system '(x w32))))
-    (blink-cursor-mode 1))
-
-  (unless noninteractive
-    ;; DOS/Windows systems have a PC-type keyboard which has both
-    ;; <delete> and <backspace> keys.
-    (when (or (memq system-type '(ms-dos windows-nt))
-             (and (memq window-system '(x))
-                  (fboundp 'x-backspace-delete-keys-p)
-                  (x-backspace-delete-keys-p))
-             ;; If the terminal Emacs is running on has erase char
-             ;; set to ^H, use the Backspace key for deleting
-             ;; backward and, and the Delete key for deleting forward.
-             (and (null window-system)
-                  (eq tty-erase-char 8)))
-      (setq-default normal-erase-is-backspace t)
-      (normal-erase-is-backspace-mode 1)))
+  ;; are not set.
+  (custom-reevaluate-setting 'blink-cursor-mode)
+  (custom-reevaluate-setting 'normal-erase-is-backspace)
 
   (unless (or noninteractive
-             emacs-quick-startup
+             emacs-basic-display
               (not (display-graphic-p))
               (not (fboundp 'x-show-tip)))
-    (setq-default tooltip-mode t)
     (tooltip-mode 1))
 
+  ;; If you change the code below, you need to also change the
+  ;; corresponding code in the xterm-mouse-mode defcustom.  The two need
+  ;; to be equivalent under all conditions, or Custom will get confused.
+  (unless (or noninteractive
+             window-system)
+    (let ((term (getenv "TERM")))
+      (and term
+          (string-match "^\\(xterm\\|rxvt\\|dtterm\\|eterm\\)" term)
+          (xterm-mouse-mode 1))))
+
   ;; Register default TTY colors for the case the terminal hasn't a
   ;; terminal init file.
   (unless (memq window-system '(x w32))
@@ -1032,8 +1027,27 @@ If this is nil, no message will be displayed."
 using the mouse.\n\n"
           :face (variable-pitch :weight bold)
           "Important Help menu items:\n"
-          :face variable-pitch "\
-Emacs Tutorial\tLearn-by-doing tutorial for using Emacs efficiently
+          :face variable-pitch
+           (lambda ()
+             (let* ((en "TUTORIAL")
+                    (tut (or (get-language-info current-language-environment
+                                                'tutorial)
+                             en))
+                    (title (with-temp-buffer
+                             (insert-file-contents
+                              (expand-file-name tut data-directory)
+                              nil 0 256)
+                             (search-forward ".")
+                             (buffer-substring (point-min) (1- (point))))))
+               ;; If there is a specific tutorial for the current language
+               ;; environment and it is not English, append its title.
+               (concat
+                "Emacs Tutorial\tLearn how to use Emacs efficiently"
+                (if (string= en tut)
+                    ""
+                  (concat " (" title ")"))
+                "\n")))
+           :face variable-pitch "\
 Emacs FAQ\tFrequently asked questions and answers
 Read the Emacs Manual\tView the Emacs manual using Info
 \(Non)Warranty\tGNU Emacs comes with "
@@ -1050,7 +1064,7 @@ using the mouse.\n\n"
           "Useful File menu items:\n"
           :face variable-pitch "\
 Exit Emacs\t(Or type Control-x followed by Control-c)
-Recover Session\tRecover files you were editing before a crash
+Recover Crashed Session\tRecover files you were editing before a crash
 
 
 
@@ -1097,14 +1111,18 @@ Values less than 60 seconds are ignored."
 
 (defun fancy-splash-insert (&rest args)
   "Insert text into the current buffer, with faces.
-Arguments from ARGS should be either strings or pairs `:face FACE',
+Arguments from ARGS should be either strings, functions called
+with no args that return a string, or pairs `:face FACE',
 where FACE is a valid face specification, as it can be used with
 `put-text-properties'."
   (let ((current-face nil))
     (while args
       (if (eq (car args) :face)
          (setq args (cdr args) current-face (car args))
-       (insert (propertize (car args)
+       (insert (propertize (let ((it (car args)))
+                              (if (functionp it)
+                                  (funcall it)
+                                it))
                            'face current-face
                            'help-echo fancy-splash-help-echo)))
       (setq args (cdr args)))))
@@ -1170,7 +1188,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) 2004 Free Software Foundation, Inc.")
+                        "Copyright (C) 2005 Free Software Foundation, Inc.")
     (and auto-save-list-file-prefix
         ;; Don't signal an error if the
         ;; directory for auto-save-list files
@@ -1486,9 +1504,16 @@ normal otherwise."
                            nil t))
                       (error nil))
                   (kill-buffer buffer)))))
-      ;; Stop any "Loading image..." message hiding echo-area-message.
-      (use-fancy-splash-screens-p)
-      (display-startup-echo-area-message))
+      ;; display-splash-screen at the end of command-line-1 calls
+      ;; use-fancy-splash-screens-p. This can cause image.el to be
+      ;; loaded, putting "Loading image... done" in the echo area.
+      ;; This hides startup-echo-area-message. So
+      ;; use-fancy-splash-screens-p is called here simply to get the
+      ;; loading of image.el (if needed) out of the way before
+      ;; display-startup-echo-area-message runs.
+      (progn
+        (use-fancy-splash-screens-p)
+        (display-startup-echo-area-message)))
 
   ;; Delay 2 seconds after an init file error message
   ;; was displayed, so user can read it.
@@ -1745,5 +1770,5 @@ normal otherwise."
       (setq file (replace-match "/" t t file)))
     file))
 
-;;; arch-tag: 7e294698-244d-4758-984b-4047f887a5db
+;; arch-tag: 7e294698-244d-4758-984b-4047f887a5db
 ;;; startup.el ends here