comparison lisp/startup.el @ 31759:85e162a05e58

(fancy-splash-head): If frame's background mode is `dark', change the black background of the image to gray. (fancy-splash-screens): Display startup echo area message. (display-startup-echo-area-message): New function. (command-line-1): Use it.
author Gerd Moellmann <gerd@gnu.org>
date Wed, 20 Sep 2000 10:54:03 +0000
parents 64e334e97502
children 57964eceb2e2
comparison
equal deleted inserted replaced
31758:c991844cbf4d 31759:85e162a05e58
878 :version "21.1" 878 :version "21.1"
879 :group 'initialization) 879 :group 'initialization)
880 880
881 881
882 (defcustom fancy-splash-delay 5 882 (defcustom fancy-splash-delay 5
883 "Delay in seconds between splash screens." 883 "*Delay in seconds between splash screens."
884 :group 'fancy-splash-screen 884 :group 'fancy-splash-screen
885 :type 'integer) 885 :type 'integer)
886 886
887 887
888 (defcustom fancy-splash-image "splash.xpm" 888 (defcustom fancy-splash-image "splash.xpm"
889 "The image to show in the splash screens." 889 "*The image to show in the splash screens."
890 :group 'fancy-splash-screen 890 :group 'fancy-splash-screen
891 :type 'file) 891 :type 'file)
892 892
893 893
894 (defun fancy-splash-insert (&rest args) 894 (defun fancy-splash-insert (&rest args)
911 (window-width (window-width (selected-window)))) 911 (window-width (window-width (selected-window))))
912 (when img 912 (when img
913 (when (> window-width image-width) 913 (when (> window-width image-width)
914 (let ((pos (/ (- window-width image-width) 2))) 914 (let ((pos (/ (- window-width image-width) 2)))
915 (insert (propertize " " 'display `(space :align-to ,pos)))) 915 (insert (propertize " " 'display `(space :align-to ,pos))))
916 (when (eq (frame-parameter nil 'background-mode) 'dark)
917 (setq img (append img '(:color-symbols (("#000000" . "gray"))))))
916 (insert-image img) 918 (insert-image img)
917 (insert "\n")))) 919 (insert "\n"))))
918 (when (eq system-type 'gnu/linux) 920 (when (eq system-type 'gnu/linux)
919 (fancy-splash-insert 921 (fancy-splash-insert
920 :face '(variable-pitch :foreground "red") 922 :face '(variable-pitch :foreground "red")
944 (while (and texts (not stop)) 946 (while (and texts (not stop))
945 (erase-buffer) 947 (erase-buffer)
946 (fancy-splash-head) 948 (fancy-splash-head)
947 (apply #'fancy-splash-insert (car texts)) 949 (apply #'fancy-splash-insert (car texts))
948 (fancy-splash-tail) 950 (fancy-splash-tail)
951 (display-startup-echo-area-message)
949 (goto-char (point-min)) 952 (goto-char (point-min))
950 (set-buffer-modified-p nil) 953 (set-buffer-modified-p nil)
951 (force-mode-line-update) 954 (force-mode-line-update)
952 (setq texts (cdr texts)) 955 (setq texts (cdr texts))
953 (setq stop (not (sit-for fancy-splash-delay))))))) 956 (setq stop (not (sit-for fancy-splash-delay)))))))
954 (setq cursor-type old-cursor-type)) 957 (setq cursor-type old-cursor-type))
955 (erase-buffer))) 958 (erase-buffer)))
956 959
957 960
961 (defun display-startup-echo-area-message ()
962 (message (if (eq (key-binding "\C-h\C-p") 'describe-project)
963 "For information about the GNU Project and its goals, type C-h C-p."
964 (substitute-command-keys
965 "For information about the GNU Project and its goals, type \\[describe-project]."))))
966
958 (defun command-line-1 (command-line-args-left) 967 (defun command-line-1 (command-line-args-left)
959 (or noninteractive (input-pending-p) init-file-had-error 968 (or noninteractive (input-pending-p) init-file-had-error
960 (and inhibit-startup-echo-area-message 969 (and inhibit-startup-echo-area-message
961 user-init-file 970 user-init-file
962 (or (and (get 'inhibit-startup-echo-area-message 'saved-value) 971 (or (and (get 'inhibit-startup-echo-area-message 'saved-value)
963 (equal inhibit-startup-echo-area-message 972 (equal inhibit-startup-echo-area-message
964 (if (string= init-file-user "") 973 (if (string= init-file-user "")
965 (user-login-name) 974 (user-login-name)
966 init-file-user))) 975 init-file-user)))
967 ;; Wasn't set with custom; see if .emacs has a setq. 976 ;; Wasn't set with custom; see if .emacs has a setq.
968 (let ((buffer (get-buffer-create " *temp*"))) 977 (let ((buffer (get-buffer-create " *temp*")))
969 (prog1 978 (prog1
970 (condition-case nil 979 (condition-case nil
971 (save-excursion 980 (save-excursion
972 (set-buffer buffer) 981 (set-buffer buffer)
973 (insert-file-contents user-init-file) 982 (insert-file-contents user-init-file)
974 (re-search-forward 983 (re-search-forward
975 (concat 984 (concat
976 "([ \t\n]*setq[ \t\n]+" 985 "([ \t\n]*setq[ \t\n]+"
977 "inhibit-startup-echo-area-message[ \t\n]+" 986 "inhibit-startup-echo-area-message[ \t\n]+"
978 (regexp-quote 987 (regexp-quote
979 (prin1-to-string 988 (prin1-to-string
980 (if (string= init-file-user "") 989 (if (string= init-file-user "")
981 (user-login-name) 990 (user-login-name)
982 init-file-user))) 991 init-file-user)))
983 "[ \t\n]*)") 992 "[ \t\n]*)")
984 nil t)) 993 nil t))
985 (error nil)) 994 (error nil))
986 (kill-buffer buffer))))) 995 (kill-buffer buffer)))))
987 (message (if (eq (key-binding "\C-h\C-p") 'describe-project) 996 (display-startup-echo-area-message))
988 "For information about the GNU Project and its goals, type C-h C-p."
989 (substitute-command-keys
990 "For information about the GNU Project and its goals, type \\[describe-project]."))))
991 (if (null command-line-args-left) 997 (if (null command-line-args-left)
992 (cond ((and (not inhibit-startup-message) (not noninteractive) 998 (cond ((and (not inhibit-startup-message) (not noninteractive)
993 ;; Don't clobber a non-scratch buffer if init file 999 ;; Don't clobber a non-scratch buffer if init file
994 ;; has selected it. 1000 ;; has selected it.
995 (string= (buffer-name) "*scratch*")) 1001 (string= (buffer-name) "*scratch*"))
1046 \(Non)Warranty GNU Emacs comes with ABSOLUTELY NO WARRANTY 1052 \(Non)Warranty GNU Emacs comes with ABSOLUTELY NO WARRANTY
1047 Copying Conditions Conditions for redistributing and changing Emacs. 1053 Copying Conditions Conditions for redistributing and changing Emacs.
1048 Getting New Versions How to obtain the latest version of Emacs. 1054 Getting New Versions How to obtain the latest version of Emacs.
1049 ") 1055 ")
1050 (insert "\n\n" (emacs-version) 1056 (insert "\n\n" (emacs-version)
1051 " 1057 "
1052 Copyright (C) 2000 Free Software Foundation, Inc."))) 1058 Copyright (C) 2000 Free Software Foundation, Inc.")))
1053 ;; If keys have their default meanings, 1059 ;; If keys have their default meanings,
1054 ;; use precomputed string to save lots of time. 1060 ;; use precomputed string to save lots of time.
1055 (if (and (eq (key-binding "\C-h") 'help-command) 1061 (if (and (eq (key-binding "\C-h") 'help-command)
1056 (eq (key-binding "\C-xu") 'advertised-undo) 1062 (eq (key-binding "\C-xu") 'advertised-undo)
1081 (insert " 1087 (insert "
1082 Activate menubar F10 or ESC ` or M-`") 1088 Activate menubar F10 or ESC ` or M-`")
1083 (insert (substitute-command-keys " 1089 (insert (substitute-command-keys "
1084 Activate menubar \\[tmm-menubar]"))) 1090 Activate menubar \\[tmm-menubar]")))
1085 1091
1086 ;; Windows and MSDOS (currently) do not count as 1092 ;; Windows and MSDOS (currently) do not count as
1087 ;; window systems, but do have mouse support. 1093 ;; window systems, but do have mouse support.
1088 (if window-system 1094 (if window-system
1089 (insert " 1095 (insert "
1090 Mode-specific menu C-mouse-3 (third button, with CTRL)")) 1096 Mode-specific menu C-mouse-3 (third button, with CTRL)"))
1091 ;; Many users seem to have problems with these. 1097 ;; Many users seem to have problems with these.
1092 (insert " 1098 (insert "
1142 (sit-for 2)) 1148 (sit-for 2))
1143 (let ((dir command-line-default-directory) 1149 (let ((dir command-line-default-directory)
1144 (file-count 0) 1150 (file-count 0)
1145 first-file-buffer 1151 first-file-buffer
1146 tem 1152 tem
1147 just-files ;; t if this follows the magic -- option. 1153 just-files;; t if this follows the magic -- option.
1148 ;; This includes our standard options' long versions 1154 ;; This includes our standard options' long versions
1149 ;; and long versions of what's on command-switch-alist. 1155 ;; and long versions of what's on command-switch-alist.
1150 (longopts 1156 (longopts
1151 (append '(("--funcall") ("--load") ("--insert") ("--kill") 1157 (append '(("--funcall") ("--load") ("--insert") ("--kill")
1152 ("--directory") ("--eval") ("--execute") 1158 ("--directory") ("--eval") ("--execute")
1201 (let ((command-line-args-left 1207 (let ((command-line-args-left
1202 (cons argval command-line-args-left))) 1208 (cons argval command-line-args-left)))
1203 (funcall (cdr tem) argi)) 1209 (funcall (cdr tem) argi))
1204 (funcall (cdr tem) argi))) 1210 (funcall (cdr tem) argi)))
1205 1211
1206 ((or (string-equal argi "-f") ;what the manual claims 1212 ((or (string-equal argi "-f") ;what the manual claims
1207 (string-equal argi "-funcall") 1213 (string-equal argi "-funcall")
1208 (string-equal argi "-e")) ; what the source used to say 1214 (string-equal argi "-e")) ; what the source used to say
1209 (if argval 1215 (if argval
1210 (setq tem (intern argval)) 1216 (setq tem (intern argval))
1211 (setq tem (intern (car command-line-args-left))) 1217 (setq tem (intern (car command-line-args-left)))
1320 (not noninteractive) 1326 (not noninteractive)
1321 (or (get-buffer-window first-file-buffer) 1327 (or (get-buffer-window first-file-buffer)
1322 (progn (other-window 1) 1328 (progn (other-window 1)
1323 (buffer-menu))))))) 1329 (buffer-menu)))))))
1324 1330
1331
1325 (defun command-line-normalize-file-name (file) 1332 (defun command-line-normalize-file-name (file)
1326 "Collapse multiple slashes to one, to handle non-Emacs file names." 1333 "Collapse multiple slashes to one, to handle non-Emacs file names."
1327 (save-match-data 1334 (save-match-data
1328 ;; Use arg 1 so that we don't collapse // at the start of the file name. 1335 ;; Use arg 1 so that we don't collapse // at the start of the file name.
1329 ;; That is significant on some systems. 1336 ;; That is significant on some systems.