diff options
| author | Gerd Moellmann | 2000-10-04 19:01:37 +0000 |
|---|---|---|
| committer | Gerd Moellmann | 2000-10-04 19:01:37 +0000 |
| commit | 5b61c6a782b52f17a9f7e951eff00f007bbedf2f (patch) | |
| tree | 2f91732dd8ca01df051812153b702d798173392c | |
| parent | 3626fb1aea15d2d4714ba46e8409a990c916c19f (diff) | |
| download | emacs-5b61c6a782b52f17a9f7e951eff00f007bbedf2f.tar.gz emacs-5b61c6a782b52f17a9f7e951eff00f007bbedf2f.zip | |
(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.
| -rw-r--r-- | lisp/startup.el | 122 |
1 files changed, 73 insertions, 49 deletions
diff --git a/lisp/startup.el b/lisp/startup.el index ac29ad87a9e..ca7c2d4b403 100644 --- a/lisp/startup.el +++ b/lisp/startup.el | |||
| @@ -495,7 +495,7 @@ or `CVS', and any subdirectory that contains a file named `.nosearch'." | |||
| 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) |
| @@ -998,40 +998,51 @@ where FACE is a valid face specification, as it can be used with | |||
| 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 () |
| @@ -1093,19 +1104,22 @@ where FACE is a valid face specification, as it can be used with | |||
| 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)) |
| @@ -1116,11 +1130,15 @@ where FACE is a valid face specification, as it can be used with | |||
| 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. |
| @@ -1139,6 +1157,7 @@ Getting New Versions How to obtain the latest version of Emacs. | |||
| 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) |
| @@ -1219,13 +1238,18 @@ 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 |