Mercurial > emacs
comparison lisp/startup.el @ 32141:ad30e402b113
(fancy-splash-pending-command): New variable.
(fancy-splash-pre-command): New function.
(fancy-splash-screens): Rewritten.
(command-line-1): If fancy-splash-pending-command is set, call it
interactively.
author | Gerd Moellmann <gerd@gnu.org> |
---|---|
date | Wed, 04 Oct 2000 19:01:37 +0000 |
parents | ca921c729a07 |
children | 70cdcabc7bbc |
comparison
equal
deleted
inserted
replaced
32140:6c61e0dbf542 | 32141:ad30e402b113 |
---|---|
493 (progn | 493 (progn |
494 (x-popup-menu nil (cdr (cdr (car submap)))) | 494 (x-popup-menu nil (cdr (cdr (car submap)))) |
495 (if purify-flag | 495 (if purify-flag |
496 (garbage-collect)))) | 496 (garbage-collect)))) |
497 (setq submap (cdr submap)))) | 497 (setq submap (cdr submap)))) |
498 (setq define-key-rebound-commands t)) | 498 (setq define-key-rebound-commands t)) |
499 | 499 |
500 (defun command-line () | 500 (defun command-line () |
501 (setq command-line-default-directory default-directory) | 501 (setq command-line-default-directory default-directory) |
502 | 502 |
503 ;; Choose a reasonable location for temporary files. | 503 ;; Choose a reasonable location for temporary files. |
996 (interactive) | 996 (interactive) |
997 (push last-command-event unread-command-events) | 997 (push last-command-event unread-command-events) |
998 (throw 'exit nil)) | 998 (throw 'exit nil)) |
999 | 999 |
1000 | 1000 |
1001 (defvar fancy-splash-pending-command nil | |
1002 "If non-nil, a command to be executed after the splash screen display.") | |
1003 | |
1004 (defun fancy-splash-pre-command () | |
1005 (unless (memq this-command | |
1006 '(ignore fancy-splash-default-action browse-url)) | |
1007 (setq fancy-splash-pending-command this-command) | |
1008 (throw 'exit nil))) | |
1009 | |
1010 | |
1001 (defun fancy-splash-screens () | 1011 (defun fancy-splash-screens () |
1002 "Display fancy splash screens when Emacs starts." | 1012 "Display fancy splash screens when Emacs starts." |
1003 (let ((old-buffer (current-buffer))) | 1013 (setq fancy-splash-help-echo (startup-echo-area-message)) |
1004 (setq fancy-splash-help-echo (startup-echo-area-message)) | 1014 (switch-to-buffer "GNU Emacs") |
1005 (switch-to-buffer "GNU Emacs") | 1015 (let ((old-global-map (current-global-map)) |
1006 (let ((old-local-map (current-local-map)) | 1016 (old-busy-cursor display-busy-cursor) |
1007 (old-global-map (current-global-map)) | 1017 (splash-buffer (current-buffer)) |
1008 (old-busy-cursor display-busy-cursor) | 1018 ;; Don't update menu bindings in the following. Since |
1009 (splash-buffer (current-buffer)) | 1019 ;; C-x etc. are not bound in the map installed below, |
1010 (show-help-function nil) | 1020 ;; there wouldn't be any bindings shown otherwise. |
1011 (fontification-functions nil) | 1021 (update-menu-bindings nil) |
1012 timer) | 1022 timer) |
1013 (unwind-protect | 1023 (unwind-protect |
1014 (let ((map (make-sparse-keymap))) | 1024 (let ((map (nconc (make-sparse-keymap) |
1015 (setq map (nconc map '((t . fancy-splash-default-action)))) | 1025 '((t . fancy-splash-default-action)))) |
1016 (define-key map [mouse-movement] 'ignore) | 1026 (show-help-function nil)) |
1017 (define-key map [menu-bar] (lookup-key old-global-map [menu-bar])) | 1027 (use-global-map map) |
1018 (define-key map [tool-bar] (lookup-key old-global-map [tool-bar])) | 1028 (use-local-map nil) |
1019 (use-global-map map) | 1029 (define-key map [mouse-movement] 'ignore) |
1020 (use-local-map nil) | 1030 (define-key map [menu-bar] (lookup-key old-global-map [menu-bar])) |
1021 (setq cursor-type nil | 1031 (define-key map [tool-bar] (lookup-key old-global-map [tool-bar])) |
1022 display-busy-cursor nil | 1032 (setq cursor-type nil |
1023 mode-line-format | 1033 display-busy-cursor nil |
1024 (propertize "---- %b %-" 'face '(:weight bold))) | 1034 mode-line-format |
1025 (setq timer (run-with-timer 0 5 #'fancy-splash-screens-1 | 1035 (propertize "---- %b %-" 'face '(:weight bold)) |
1026 splash-buffer)) | 1036 timer (run-with-timer 0 5 #'fancy-splash-screens-1 |
1027 (recursive-edit)) | 1037 splash-buffer)) |
1028 (use-local-map old-local-map) | 1038 (add-hook 'pre-command-hook 'fancy-splash-pre-command) |
1029 (use-global-map old-global-map) | 1039 (recursive-edit)) |
1030 (cancel-timer timer) | 1040 (trace-to-stderr "EXITTT\n") |
1031 (switch-to-buffer old-buffer) | 1041 (cancel-timer timer) |
1032 (kill-buffer splash-buffer) | 1042 (remove-hook 'pre-command-hook 'fancy-splash-pre-command) |
1033 (erase-buffer) | 1043 (use-global-map old-global-map) |
1034 (setq display-busy-cursor old-busy-cursor))))) | 1044 (setq display-busy-cursor old-busy-cursor) |
1045 (kill-buffer splash-buffer)))) | |
1035 | 1046 |
1036 | 1047 |
1037 (defun startup-echo-area-message () | 1048 (defun startup-echo-area-message () |
1038 (if (eq (key-binding "\C-h\C-p") 'describe-project) | 1049 (if (eq (key-binding "\C-h\C-p") 'describe-project) |
1039 "For information about the GNU Project and its goals, type C-h C-p." | 1050 "For information about the GNU Project and its goals, type C-h C-p." |
1091 | 1102 |
1092 ;; It's important to notice the user settings before we | 1103 ;; It's important to notice the user settings before we |
1093 ;; display the startup message; otherwise, the settings | 1104 ;; display the startup message; otherwise, the settings |
1094 ;; won't take effect until the user gives the first | 1105 ;; won't take effect until the user gives the first |
1095 ;; keystroke, and that's distracting. | 1106 ;; keystroke, and that's distracting. |
1096 (if (fboundp 'frame-notice-user-settings) | 1107 (when (fboundp 'frame-notice-user-settings) |
1097 (frame-notice-user-settings)) | 1108 (frame-notice-user-settings)) |
1098 | 1109 |
1099 (and window-setup-hook | 1110 (when window-setup-hook |
1100 (run-hooks 'window-setup-hook)) | 1111 (run-hooks 'window-setup-hook) |
1101 (setq window-setup-hook nil) | 1112 (setq window-setup-hook nil)) |
1113 | |
1114 (when (memq window-system '(x w32)) | |
1115 (precompute-menubar-bindings)) | |
1116 (setq menubar-bindings-done t) | |
1117 | |
1102 ;; Do this now to avoid an annoying delay if the user | 1118 ;; Do this now to avoid an annoying delay if the user |
1103 ;; clicks the menu bar during the sit-for. | 1119 ;; clicks the menu bar during the sit-for. |
1104 (when (memq window-system '(x w32)) | |
1105 (precompute-menubar-bindings)) | |
1106 (setq menubar-bindings-done t) | |
1107 (when (= (buffer-size) 0) | 1120 (when (= (buffer-size) 0) |
1108 (let ((buffer-undo-list t)) | 1121 (let ((buffer-undo-list t) |
1122 (wait-for-input t)) | |
1109 (unwind-protect | 1123 (unwind-protect |
1110 (when (not (input-pending-p)) | 1124 (when (not (input-pending-p)) |
1111 (goto-char (point-max)) | 1125 (goto-char (point-max)) |
1112 ;; The convention for this piece of code is that | 1126 ;; The convention for this piece of code is that |
1113 ;; each piece of output starts with one or two newlines | 1127 ;; each piece of output starts with one or two newlines |
1114 ;; and does not end with any newlines. | 1128 ;; and does not end with any newlines. |
1115 (insert "Welcome to GNU Emacs") | 1129 (insert "Welcome to GNU Emacs") |
1116 (if (eq system-type 'gnu/linux) | 1130 (if (eq system-type 'gnu/linux) |
1117 (insert ", one component of a Linux-based GNU system.")) | 1131 (insert ", one component of a Linux-based GNU system.")) |
1118 (insert "\n") | 1132 (insert "\n") |
1133 | |
1119 (if (assq 'display (frame-parameters)) | 1134 (if (assq 'display (frame-parameters)) |
1135 | |
1120 (if (or (and (display-color-p) | 1136 (if (or (and (display-color-p) |
1121 (image-type-available-p 'xpm)) | 1137 (image-type-available-p 'xpm)) |
1122 (image-type-available-p 'pbm)) | 1138 (image-type-available-p 'pbm)) |
1123 (fancy-splash-screens) | 1139 (progn |
1140 (setq wait-for-input nil) | |
1141 (fancy-splash-screens)) | |
1124 (progn | 1142 (progn |
1125 (insert "\ | 1143 (insert "\ |
1126 You can do basic editing with the menu bar and scroll bar using the mouse. | 1144 You can do basic editing with the menu bar and scroll bar using the mouse. |
1127 | 1145 |
1128 Useful Files menu items: | 1146 Useful Files menu items: |
1137 Getting New Versions How to obtain the latest version of Emacs. | 1155 Getting New Versions How to obtain the latest version of Emacs. |
1138 ") | 1156 ") |
1139 (insert "\n\n" (emacs-version) | 1157 (insert "\n\n" (emacs-version) |
1140 " | 1158 " |
1141 Copyright (C) 2000 Free Software Foundation, Inc."))) | 1159 Copyright (C) 2000 Free Software Foundation, Inc."))) |
1160 | |
1142 ;; If keys have their default meanings, | 1161 ;; If keys have their default meanings, |
1143 ;; use precomputed string to save lots of time. | 1162 ;; use precomputed string to save lots of time. |
1144 (if (and (eq (key-binding "\C-h") 'help-command) | 1163 (if (and (eq (key-binding "\C-h") 'help-command) |
1145 (eq (key-binding "\C-xu") 'advertised-undo) | 1164 (eq (key-binding "\C-xu") 'advertised-undo) |
1146 (eq (key-binding "\C-x\C-c") 'save-buffers-kill-emacs) | 1165 (eq (key-binding "\C-x\C-c") 'save-buffers-kill-emacs) |
1217 of Emacs and modify it; type \\[describe-copying] to see the conditions. | 1236 of Emacs and modify it; type \\[describe-copying] to see the conditions. |
1218 Type \\[describe-distribution] for information on getting the latest version.")))) | 1237 Type \\[describe-distribution] for information on getting the latest version.")))) |
1219 (goto-char (point-min)) | 1238 (goto-char (point-min)) |
1220 | 1239 |
1221 (set-buffer-modified-p nil) | 1240 (set-buffer-modified-p nil) |
1222 (sit-for 120) | 1241 (when wait-for-input |
1223 ) | 1242 (sit-for 120))) |
1243 | |
1224 (with-current-buffer (get-buffer "*scratch*") | 1244 (with-current-buffer (get-buffer "*scratch*") |
1225 (erase-buffer) | 1245 (erase-buffer) |
1226 (and initial-scratch-message | 1246 (when initial-scratch-message |
1227 (insert initial-scratch-message)) | 1247 (insert initial-scratch-message)) |
1228 (set-buffer-modified-p nil))))))) | 1248 (set-buffer-modified-p nil)) |
1249 | |
1250 (when fancy-splash-pending-command | |
1251 (call-interactively fancy-splash-pending-command))))))) | |
1252 | |
1229 ;; Delay 2 seconds after the init file error message | 1253 ;; Delay 2 seconds after the init file error message |
1230 ;; was displayed, so user can read it. | 1254 ;; was displayed, so user can read it. |
1231 (if init-file-had-error | 1255 (if init-file-had-error |
1232 (sit-for 2)) | 1256 (sit-for 2)) |
1233 (let ((dir command-line-default-directory) | 1257 (let ((dir command-line-default-directory) |