aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGerd Moellmann2000-09-29 19:12:14 +0000
committerGerd Moellmann2000-09-29 19:12:14 +0000
commitf645586f0ea84e893bd182033d9a9d2894c80a4e (patch)
tree1bb4eccea72eb7c90071160a4d2637ca6584c0db
parentbdbe3a8995c5f1dae126acd4be4872f6af687cd1 (diff)
downloademacs-f645586f0ea84e893bd182033d9a9d2894c80a4e.tar.gz
emacs-f645586f0ea84e893bd182033d9a9d2894c80a4e.zip
(startup-echo-area-message): New function.
(display-startup-echo-area-message): Use it. (fancy-splash-screens): Rewritten to use keymaps and a timer. (fancy-splash-default-action): New function. (fancy-splash-screens-1): New function. (fancy-splash-head): Put a help-echo and a keymap under the image.
-rw-r--r--lisp/startup.el123
1 files changed, 95 insertions, 28 deletions
diff --git a/lisp/startup.el b/lisp/startup.el
index 062a2851e70..43e8bb7d20d 100644
--- a/lisp/startup.el
+++ b/lisp/startup.el
@@ -898,6 +898,12 @@ Each element in the list should be a list of strings or pairs
898 (file :tag "File"))) 898 (file :tag "File")))
899 899
900 900
901;; These are temporary storage areas for the splash screen display.
902
903(defvar fancy-current-text nil)
904(defvar fancy-splash-help-echo nil)
905
906
901(defun fancy-splash-insert (&rest args) 907(defun fancy-splash-insert (&rest args)
902 "Insert text into the current buffer, with faces. 908 "Insert text into the current buffer, with faces.
903Arguments from ARGS should be either strings or pairs `:face FACE', 909Arguments from ARGS should be either strings or pairs `:face FACE',
@@ -907,7 +913,9 @@ where FACE is a valid face specification, as it can be used with
907 (while args 913 (while args
908 (if (eq (car args) :face) 914 (if (eq (car args) :face)
909 (setq args (cdr args) current-face (car args)) 915 (setq args (cdr args) current-face (car args))
910 (insert (propertize (car args) 'face current-face))) 916 (insert (propertize (car args)
917 'face current-face
918 'help-echo fancy-splash-help-echo)))
911 (setq args (cdr args))))) 919 (setq args (cdr args)))))
912 920
913 921
@@ -921,12 +929,28 @@ where FACE is a valid face specification, as it can be used with
921 (window-width (window-width (selected-window)))) 929 (window-width (window-width (selected-window))))
922 (when img 930 (when img
923 (when (> window-width image-width) 931 (when (> window-width image-width)
932 ;; Center the image in the window.
924 (let ((pos (/ (- window-width image-width) 2))) 933 (let ((pos (/ (- window-width image-width) 2)))
925 (insert (propertize " " 'display `(space :align-to ,pos)))) 934 (insert (propertize " " 'display `(space :align-to ,pos))))
935
936 ;; Change the color of the XPM version of the splash image
937 ;; so that it is visible with a dark frame background.
926 (when (and (memq 'xpm img) 938 (when (and (memq 'xpm img)
927 (eq (frame-parameter nil 'background-mode) 'dark)) 939 (eq (frame-parameter nil 'background-mode) 'dark))
928 (setq img (append img '(:color-symbols (("#000000" . "gray")))))) 940 (setq img (append img '(:color-symbols (("#000000" . "gray"))))))
929 (insert-image img) 941
942 ;; Insert the image with a help-echo and a keymap.
943 (let ((map (make-sparse-keymap))
944 (help-echo "mouse-2: browse http://www.gnu.org"))
945 (define-key map [mouse-2]
946 (lambda ()
947 (interactive)
948 (browse-url "http://www.gnu.org")
949 (throw 'exit nil)))
950 (define-key map [down-mouse-2] 'ignore)
951 (define-key map [up-mouse-2] 'ignore)
952 (insert-image img (propertize "xxx" 'help-echo help-echo
953 'keymap map)))
930 (insert "\n")))) 954 (insert "\n"))))
931 (when (eq system-type 'gnu/linux) 955 (when (eq system-type 'gnu/linux)
932 (fancy-splash-insert 956 (fancy-splash-insert
@@ -947,35 +971,77 @@ where FACE is a valid face specification, as it can be used with
947 "Copyright (C) 2000 Free Software Foundation, Inc."))) 971 "Copyright (C) 2000 Free Software Foundation, Inc.")))
948 972
949 973
974(defun fancy-splash-screens-1 (buffer)
975 "Timer function displaying a splash screen."
976 (unless fancy-current-text
977 (setq fancy-current-text fancy-splash-text))
978 (let ((text (car fancy-current-text)))
979 (set-buffer buffer)
980 (erase-buffer)
981 (fancy-splash-head)
982 (apply #'fancy-splash-insert text)
983 (fancy-splash-tail)
984 (unless (current-message)
985 (message fancy-splash-help-echo))
986 (set-buffer-modified-p nil)
987 (force-mode-line-update)
988 (setq fancy-current-text (cdr fancy-current-text))))
989
990
991(defun fancy-splash-default-action ()
992 "Default action for events in the splash screen buffer."
993 (interactive)
994 (push last-command-event unread-command-events)
995 (throw 'exit nil))
996
997
950(defun fancy-splash-screens () 998(defun fancy-splash-screens ()
951 "Display splash screens when Emacs starts." 999 "Display fancy splash screens when Emacs starts."
952 (let* ((old-cursor-type cursor-type) 1000 (let ((old-buffer (current-buffer)))
953 stop) 1001 (setq fancy-splash-help-echo (startup-echo-area-message))
954 (unwind-protect 1002 (switch-to-buffer "GNU Emacs")
955 (progn 1003 (let ((old-local-map (current-local-map))
956 (setq cursor-type nil) 1004 (old-global-map (current-global-map))
957 (while (not stop) 1005 (old-busy-cursor display-busy-cursor)
958 (let ((texts fancy-splash-text)) 1006 (splash-buffer (current-buffer))
959 (while (and texts (not stop)) 1007 (show-help-function nil)
960 (erase-buffer) 1008 (fontification-functions nil)
961 (fancy-splash-head) 1009 timer)
962 (apply #'fancy-splash-insert (car texts)) 1010 (unwind-protect
963 (fancy-splash-tail) 1011 (let ((map (make-sparse-keymap)))
964 (display-startup-echo-area-message) 1012 (setq map (nconc map '((t . fancy-splash-default-action))))
965 (goto-char (point-min)) 1013 (define-key map [mouse-movement] 'ignore)
966 (set-buffer-modified-p nil) 1014 (define-key map [menu-bar] (lookup-key old-global-map [menu-bar]))
967 (force-mode-line-update) 1015 (define-key map [tool-bar] (lookup-key old-global-map [tool-bar]))
968 (setq texts (cdr texts)) 1016 (use-global-map map)
969 (setq stop (not (sit-for fancy-splash-delay))))))) 1017 (use-local-map nil)
970 (setq cursor-type old-cursor-type)) 1018 (setq cursor-type nil
971 (erase-buffer))) 1019 display-busy-cursor nil
1020 mode-line-format
1021 (propertize "---- %b %-" 'face '(:weight bold)))
1022 (setq timer (run-with-timer 0 5 #'fancy-splash-screens-1
1023 splash-buffer))
1024 (recursive-edit))
1025 (use-local-map old-local-map)
1026 (use-global-map old-global-map)
1027 (cancel-timer timer)
1028 (switch-to-buffer old-buffer)
1029 (kill-buffer splash-buffer)
1030 (erase-buffer)
1031 (setq display-busy-cursor old-busy-cursor)))))
1032
1033
1034(defun startup-echo-area-message ()
1035 (if (eq (key-binding "\C-h\C-p") 'describe-project)
1036 "For information about the GNU Project and its goals, type C-h C-p."
1037 (substitute-command-keys
1038 "For information about the GNU Project and its goals, type \
1039\\[describe-project].")))
972 1040
973 1041
974(defun display-startup-echo-area-message () 1042(defun display-startup-echo-area-message ()
975 (message (if (eq (key-binding "\C-h\C-p") 'describe-project) 1043 (message (startup-echo-area-message)))
976 "For information about the GNU Project and its goals, type C-h C-p." 1044
977 (substitute-command-keys
978 "For information about the GNU Project and its goals, type \\[describe-project]."))))
979 1045
980(defun command-line-1 (command-line-args-left) 1046(defun command-line-1 (command-line-args-left)
981 (or noninteractive (input-pending-p) init-file-had-error 1047 (or noninteractive (input-pending-p) init-file-had-error
@@ -1150,7 +1216,8 @@ Type \\[describe-distribution] for information on getting the latest version."))
1150 (goto-char (point-min)) 1216 (goto-char (point-min))
1151 1217
1152 (set-buffer-modified-p nil) 1218 (set-buffer-modified-p nil)
1153 (sit-for 120)) 1219 (sit-for 120)
1220 )
1154 (with-current-buffer (get-buffer "*scratch*") 1221 (with-current-buffer (get-buffer "*scratch*")
1155 (erase-buffer) 1222 (erase-buffer)
1156 (and initial-scratch-message 1223 (and initial-scratch-message