comparison lisp/startup.el @ 90261:7beb78bc1f8e

Revision: miles@gnu.org--gnu-2005/emacs--unicode--0--patch-97 Merge from emacs--cvs-trunk--0 Patches applied: * emacs--cvs-trunk--0 (patch 616-696) - Add lisp/mh-e/.arch-inventory - Update from CVS - Merge from gnus--rel--5.10 - Update from CVS: lisp/smerge-mode.el: Add 'tools' to file keywords. - lisp/gnus/ChangeLog: Remove duplicate entry * gnus--rel--5.10 (patch 147-181) - Update from CVS - Merge from emacs--cvs-trunk--0 - Update from CVS: lisp/mml.el (mml-preview): Doc fix. - Update from CVS: texi/message.texi: Fix default values. - Update from CVS: texi/gnus.texi (RSS): Addition.
author Miles Bader <miles@gnu.org>
date Mon, 16 Jan 2006 08:37:27 +0000
parents 0ca0d9181b5e 4baa8cfc2485
children 5b7d410e31f9
comparison
equal deleted inserted replaced
90260:0ca0d9181b5e 90261:7beb78bc1f8e
1 ;;; startup.el --- process Emacs shell arguments 1 ;;; startup.el --- process Emacs shell arguments
2 2
3 ;; Copyright (C) 1985, 1986, 1992, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 3 ;; Copyright (C) 1985, 1986, 1992, 1994, 1995, 1996, 1997, 1998, 1999, 2000,
4 ;; 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc. 4 ;; 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
5 5
6 ;; Maintainer: FSF 6 ;; Maintainer: FSF
7 ;; Keywords: internal 7 ;; Keywords: internal
8 8
9 ;; This file is part of GNU Emacs. 9 ;; This file is part of GNU Emacs.
38 38
39 (defgroup initialization nil 39 (defgroup initialization nil
40 "Emacs start-up procedure." 40 "Emacs start-up procedure."
41 :group 'internal) 41 :group 'internal)
42 42
43 (defcustom inhibit-startup-message nil 43 (defcustom inhibit-splash-screen nil
44 "*Non-nil inhibits the initial startup message. 44 "*Non-nil inhibits the startup screen.
45 This is for use in your personal init file, once you are familiar 45 This is for use in your personal init file, once you are familiar
46 with the contents of the startup message." 46 with the contents of the startup screen."
47 :type 'boolean 47 :type 'boolean
48 :group 'initialization) 48 :group 'initialization)
49 49
50 (defvaralias 'inhibit-splash-screen 'inhibit-startup-message) 50 (defvaralias 'inhibit-startup-message 'inhibit-splash-screen)
51 51
52 (defcustom inhibit-startup-echo-area-message nil 52 (defcustom inhibit-startup-echo-area-message nil
53 "*Non-nil inhibits the initial startup echo area message. 53 "*Non-nil inhibits the initial startup echo area message.
54 Setting this variable takes effect 54 Setting this variable takes effect
55 only if you do it with the customization buffer 55 only if you do it with the customization buffer
195 (defcustom initial-major-mode 'lisp-interaction-mode 195 (defcustom initial-major-mode 'lisp-interaction-mode
196 "Major mode command symbol to use for the initial *scratch* buffer." 196 "Major mode command symbol to use for the initial *scratch* buffer."
197 :type 'function 197 :type 'function
198 :group 'initialization) 198 :group 'initialization)
199 199
200 (defcustom init-file-user nil 200 (defvar init-file-user nil
201 "Identity of user whose `.emacs' file is or was read. 201 "Identity of user whose `.emacs' file is or was read.
202 The value is nil if `-q' or `--no-init-file' was specified, 202 The value is nil if `-q' or `--no-init-file' was specified,
203 meaning do not load any init file. 203 meaning do not load any init file.
204 204
205 Otherwise, the value may be the null string, meaning use the init file 205 Otherwise, the value may be an empty string, meaning
206 for the user that originally logged in, or it may be a 206 use the init file for the user who originally logged in,
207 string containing a user's name meaning use that person's init file. 207 or it may be a string containing a user's name meaning
208 use that person's init file.
208 209
209 In either of the latter cases, `(concat \"~\" init-file-user \"/\")' 210 In either of the latter cases, `(concat \"~\" init-file-user \"/\")'
210 evaluates to the name of the directory where the `.emacs' file was 211 evaluates to the name of the directory where the `.emacs' file was
211 looked for. 212 looked for.
212 213
213 Setting `init-file-user' does not prevent Emacs from loading 214 Setting `init-file-user' does not prevent Emacs from loading
214 `site-start.el'. The only way to do that is to use `--no-site-file'." 215 `site-start.el'. The only way to do that is to use `--no-site-file'.")
215 :type '(choice (const :tag "none" nil) string)
216 :group 'initialization)
217 216
218 (defcustom site-run-file "site-start" 217 (defcustom site-run-file "site-start"
219 "File containing site-wide run-time initializations. 218 "File containing site-wide run-time initializations.
220 This file is loaded at run-time before `~/.emacs'. It contains inits 219 This file is loaded at run-time before `~/.emacs'. It contains inits
221 that need to be in place for the entire site, but which, due to their 220 that need to be in place for the entire site, but which, due to their
640 (setq command-line-args (tty-handle-args command-line-args))) 639 (setq command-line-args (tty-handle-args command-line-args)))
641 640
642 (set-locale-environment nil) 641 (set-locale-environment nil)
643 642
644 ;; Convert preloaded file names to absolute. 643 ;; Convert preloaded file names to absolute.
645 (setq load-history 644 (let ((lisp-dir
646 (mapcar (lambda (elt) 645 (file-name-directory
647 (if (and (stringp (car elt)) 646 (locate-file "simple" load-path
648 (not (file-name-absolute-p (car elt)))) 647 load-suffixes))))
649 (cons (locate-file (car elt) load-path 648
650 load-suffixes) 649 (setq load-history
651 (cdr elt)) 650 (mapcar (lambda (elt)
652 elt)) 651 (if (and (stringp (car elt))
653 load-history)) 652 (not (file-name-absolute-p (car elt))))
653 (cons (concat lisp-dir
654 (car elt)
655 (if (string-match "[.]el$" (car elt))
656 "" ".elc"))
657 (cdr elt))
658 elt))
659 load-history)))
654 660
655 ;; Convert the arguments to Emacs internal representation. 661 ;; Convert the arguments to Emacs internal representation.
656 (let ((args (cdr command-line-args))) 662 (let ((args (cdr command-line-args)))
657 (while args 663 (while args
658 (setcar args 664 (setcar args
729 735
730 ;; Re-attach the program name to the front of the arg list. 736 ;; Re-attach the program name to the front of the arg list.
731 (and command-line-args 737 (and command-line-args
732 (setcdr command-line-args args))) 738 (setcdr command-line-args args)))
733 739
740 (run-hooks 'before-init-hook)
741
734 ;; Under X Window, this creates the X frame and deletes the terminal frame. 742 ;; Under X Window, this creates the X frame and deletes the terminal frame.
735 (when (fboundp 'frame-initialize) 743 (when (fboundp 'frame-initialize)
736 (frame-initialize)) 744 (frame-initialize))
737 745
738 ;; Turn off blinking cursor if so specified in X resources. This is here 746 ;; Turn off blinking cursor if so specified in X resources. This is here
761 ;; Can't do this init in defcustom because the relevant variables 769 ;; Can't do this init in defcustom because the relevant variables
762 ;; are not set. 770 ;; are not set.
763 (custom-reevaluate-setting 'blink-cursor-mode) 771 (custom-reevaluate-setting 'blink-cursor-mode)
764 (custom-reevaluate-setting 'normal-erase-is-backspace) 772 (custom-reevaluate-setting 'normal-erase-is-backspace)
765 (custom-reevaluate-setting 'tooltip-mode) 773 (custom-reevaluate-setting 'tooltip-mode)
774 (custom-reevaluate-setting 'global-font-lock-mode)
775 (custom-reevaluate-setting 'mouse-wheel-down-event)
776 (custom-reevaluate-setting 'mouse-wheel-up-event)
777 (custom-reevaluate-setting 'file-name-shadow-mode)
778 (custom-reevaluate-setting 'send-mail-function)
766 779
767 ;; Register default TTY colors for the case the terminal hasn't a 780 ;; Register default TTY colors for the case the terminal hasn't a
768 ;; terminal init file. 781 ;; terminal init file.
769 (unless (memq window-system '(x w32)) 782 (unless (memq window-system '(x w32 mac))
770 ;; We do this regardles of whether the terminal supports colors 783 ;; We do this regardles of whether the terminal supports colors
771 ;; or not, since they can switch that support on or off in 784 ;; or not, since they can switch that support on or off in
772 ;; mid-session by setting the tty-color-mode frame parameter. 785 ;; mid-session by setting the tty-color-mode frame parameter.
773 (tty-register-default-colors)) 786 (tty-register-default-colors))
774 787
786 799
787 (let ((old-scalable-fonts-allowed scalable-fonts-allowed) 800 (let ((old-scalable-fonts-allowed scalable-fonts-allowed)
788 (old-font-list-limit font-list-limit) 801 (old-font-list-limit font-list-limit)
789 (old-face-ignored-fonts face-ignored-fonts)) 802 (old-face-ignored-fonts face-ignored-fonts))
790 803
791 (run-hooks 'before-init-hook)
792
793 ;; Run the site-start library if it exists. The point of this file is 804 ;; Run the site-start library if it exists. The point of this file is
794 ;; that it is run before .emacs. There is no point in doing this after 805 ;; that it is run before .emacs. There is no point in doing this after
795 ;; .emacs; that is useless. 806 ;; .emacs; that is useless.
796 (if site-run-file 807 (if site-run-file
797 (load site-run-file t t)) 808 (load site-run-file t t))
799 ;; Sites should not disable this. Only individuals should disable 810 ;; Sites should not disable this. Only individuals should disable
800 ;; the startup message. 811 ;; the startup message.
801 (setq inhibit-startup-message nil) 812 (setq inhibit-startup-message nil)
802 813
803 ;; Warn for invalid user name. 814 ;; Warn for invalid user name.
804 (and init-file-user 815 (when init-file-user
805 (not (file-directory-p (expand-file-name (concat "~" init-file-user)))) 816 (if (string-match "[~/:\n]" init-file-user)
806 (display-warning 'initialization 817 (display-warning 'initialization
807 (format "User %s has no home directory" 818 (format "Invalid user name %s"
808 init-file-user) 819 init-file-user)
809 :error)) 820 :error)
821 (if (file-directory-p (expand-file-name (concat "~" init-file-user)))
822 nil
823 (display-warning 'initialization
824 (format "User %s has no home directory"
825 init-file-user)
826 :error))))
810 827
811 ;; Load that user's init file, or the default one, or none. 828 ;; Load that user's init file, or the default one, or none.
812 (let (debug-on-error-from-init-file 829 (let (debug-on-error-from-init-file
813 debug-on-error-should-be-set 830 debug-on-error-should-be-set
814 (debug-on-error-initial 831 (debug-on-error-initial
842 (setq user-init-file t) 859 (setq user-init-file t)
843 (load user-init-file-1 t t) 860 (load user-init-file-1 t t)
844 861
845 (when (eq user-init-file t) 862 (when (eq user-init-file t)
846 ;; If we did not find ~/.emacs, try 863 ;; If we did not find ~/.emacs, try
847 ;; ~/.emacs.d/.emacs. 864 ;; ~/.emacs.d/init.el.
848 (let ((otherfile 865 (let ((otherfile
849 (expand-file-name 866 (expand-file-name
850 (file-name-nondirectory user-init-file-1) 867 "init"
851 (file-name-as-directory 868 (file-name-as-directory
852 (expand-file-name 869 (concat "~" init-file-user "/.emacs.d")))))
853 ".emacs.d"
854 (file-name-directory user-init-file-1))))))
855 (load otherfile t t) 870 (load otherfile t t)
856 871
857 ;; If we did not find the user's init file, 872 ;; If we did not find the user's init file,
858 ;; set user-init-file conclusively. 873 ;; set user-init-file conclusively.
859 ;; Don't let it be set from default.el. 874 ;; Don't let it be set from default.el.
913 (mapconcat 'prin1-to-string (cdr error) ", ")) 928 (mapconcat 'prin1-to-string (cdr error) ", "))
914 (let ((pop-up-windows nil)) 929 (let ((pop-up-windows nil))
915 (pop-to-buffer "*Messages*")) 930 (pop-to-buffer "*Messages*"))
916 (setq init-file-had-error t))))) 931 (setq init-file-had-error t)))))
917 932
933 (if (and deactivate-mark transient-mark-mode)
934 (with-current-buffer (window-buffer)
935 (deactivate-mark)))
936
918 ;; If the user has a file of abbrevs, read it. 937 ;; If the user has a file of abbrevs, read it.
919 (if (file-exists-p abbrev-file-name) 938 (if (file-exists-p abbrev-file-name)
920 (quietly-read-abbrev-file abbrev-file-name)) 939 (quietly-read-abbrev-file abbrev-file-name))
921 940
922 ;; If the abbrevs came entirely from the init file or the 941 ;; If the abbrevs came entirely from the init file or the
949 ;; Do this here in case the init file sets mail-host-address. 968 ;; Do this here in case the init file sets mail-host-address.
950 (if (equal user-mail-address "") 969 (if (equal user-mail-address "")
951 (setq user-mail-address (concat (user-login-name) "@" 970 (setq user-mail-address (concat (user-login-name) "@"
952 (or mail-host-address 971 (or mail-host-address
953 (system-name))))) 972 (system-name)))))
973
974 ;; Originally face attributes were specified via
975 ;; `font-lock-face-attributes'. Users then changed the default
976 ;; face attributes by setting that variable. However, we try and
977 ;; be back-compatible and respect its value if set except for
978 ;; faces where M-x customize has been used to save changes for the
979 ;; face.
980 (when (boundp 'font-lock-face-attributes)
981 (let ((face-attributes font-lock-face-attributes))
982 (while face-attributes
983 (let* ((face-attribute (pop face-attributes))
984 (face (car face-attribute)))
985 ;; Rustle up a `defface' SPEC from a
986 ;; `font-lock-face-attributes' entry.
987 (unless (get face 'saved-face)
988 (let ((foreground (nth 1 face-attribute))
989 (background (nth 2 face-attribute))
990 (bold-p (nth 3 face-attribute))
991 (italic-p (nth 4 face-attribute))
992 (underline-p (nth 5 face-attribute))
993 face-spec)
994 (when foreground
995 (setq face-spec (cons ':foreground (cons foreground face-spec))))
996 (when background
997 (setq face-spec (cons ':background (cons background face-spec))))
998 (when bold-p
999 (setq face-spec (append '(:weight bold) face-spec)))
1000 (when italic-p
1001 (setq face-spec (append '(:slant italic) face-spec)))
1002 (when underline-p
1003 (setq face-spec (append '(:underline t) face-spec)))
1004 (face-spec-set face (list (list t face-spec)) nil)))))))
954 1005
955 ;; If parameter have been changed in the init file which influence 1006 ;; If parameter have been changed in the init file which influence
956 ;; face realization, clear the face cache so that new faces will 1007 ;; face realization, clear the face cache so that new faces will
957 ;; be realized. 1008 ;; be realized.
958 (unless (and (eq scalable-fonts-allowed old-scalable-fonts-allowed) 1009 (unless (and (eq scalable-fonts-allowed old-scalable-fonts-allowed)
1215 (fancy-splash-insert :face `(variable-pitch :foreground ,fg) 1266 (fancy-splash-insert :face `(variable-pitch :foreground ,fg)
1216 "\nThis is " 1267 "\nThis is "
1217 (emacs-version) 1268 (emacs-version)
1218 "\n" 1269 "\n"
1219 :face '(variable-pitch :height 0.5) 1270 :face '(variable-pitch :height 0.5)
1220 "Copyright (C) 2005 Free Software Foundation, Inc.") 1271 "Copyright (C) 2006 Free Software Foundation, Inc.")
1221 (and auto-save-list-file-prefix 1272 (and auto-save-list-file-prefix
1222 ;; Don't signal an error if the 1273 ;; Don't signal an error if the
1223 ;; directory for auto-save-list files 1274 ;; directory for auto-save-list files
1224 ;; does not yet exist. 1275 ;; does not yet exist.
1225 (file-directory-p (file-name-directory 1276 (file-directory-p (file-name-directory
1262 "Stop displaying the splash screen buffer. 1313 "Stop displaying the splash screen buffer.
1263 This is an internal function used to turn off the splash screen after 1314 This is an internal function used to turn off the splash screen after
1264 the user caused an input event by hitting a key or clicking with the 1315 the user caused an input event by hitting a key or clicking with the
1265 mouse." 1316 mouse."
1266 (interactive) 1317 (interactive)
1267 (if (and (consp last-command-event) 1318 (if (and (memq 'down (event-modifiers last-command-event))
1268 (eq (posn-window (event-start last-command-event)) 1319 (eq (posn-window (event-start last-command-event))
1269 (selected-window))) 1320 (selected-window)))
1270 ;; This is a mouse-down event in the spash screen window. 1321 ;; This is a mouse-down event in the spash screen window.
1271 ;; Ignore it and consume the corresponding mouse-up event. 1322 ;; Ignore it and consume the corresponding mouse-up event.
1272 (read-event) 1323 (read-event)
1387 Getting New Versions How to obtain the latest version of Emacs 1438 Getting New Versions How to obtain the latest version of Emacs
1388 More Manuals / Ordering Manuals How to order printed manuals from the FSF 1439 More Manuals / Ordering Manuals How to order printed manuals from the FSF
1389 ") 1440 ")
1390 (insert "\n\n" (emacs-version) 1441 (insert "\n\n" (emacs-version)
1391 " 1442 "
1392 Copyright (C) 2005 Free Software Foundation, Inc.")) 1443 Copyright (C) 2006 Free Software Foundation, Inc."))
1393 1444
1394 ;; No mouse menus, so give help using kbd commands. 1445 ;; No mouse menus, so give help using kbd commands.
1395 1446
1396 ;; If keys have their default meanings, 1447 ;; If keys have their default meanings,
1397 ;; use precomputed string to save lots of time. 1448 ;; use precomputed string to save lots of time.
1435 \(`C-' means use the CTRL key. `M-' means use the Meta (or Alt) key. 1486 \(`C-' means use the CTRL key. `M-' means use the Meta (or Alt) key.
1436 If you have no Meta key, you may instead type ESC followed by the character.)") 1487 If you have no Meta key, you may instead type ESC followed by the character.)")
1437 1488
1438 (insert "\n\n" (emacs-version) 1489 (insert "\n\n" (emacs-version)
1439 " 1490 "
1440 Copyright (C) 2005 Free Software Foundation, Inc.") 1491 Copyright (C) 2006 Free Software Foundation, Inc.")
1441 1492
1442 (if (and (eq (key-binding "\C-h\C-c") 'describe-copying) 1493 (if (and (eq (key-binding "\C-h\C-c") 'describe-copying)
1443 (eq (key-binding "\C-h\C-d") 'describe-distribution) 1494 (eq (key-binding "\C-h\C-d") 'describe-distribution)
1444 (eq (key-binding "\C-h\C-w") 'describe-no-warranty)) 1495 (eq (key-binding "\C-h\C-w") 'describe-no-warranty))
1445 (insert 1496 (insert