Mercurial > emacs
comparison lisp/startup.el @ 82468:4f98fbdaf9ce
(splash-screen-keymap): Rename from `fancy-splash-keymap'
because it's common to both types of splash screen: fancy and normal.
Bind SPC to scroll-up, DEL to scroll-down and `q' to exit-splash-screen.
(exit-splash-screen): Rename from `fancy-splash-quit'.
Use `quit-window' instead of `kill-buffer'.
(fancy-splash-head): Use make-button to insert GNU image link.
(fancy-splash-screens, normal-splash-screen): Rename " About GNU
Emacs" to "*About GNU Emacs*", and " GNU Emacs" to "*GNU Emacs*".
(normal-splash-screen): Put "Browse manuals" on the same line with
"Emacs manual". Remove descriptions from "Useful tasks" and put
all links in two columns on two lines.
author | Juri Linkov <juri@jurta.org> |
---|---|
date | Sun, 19 Aug 2007 14:43:25 +0000 |
parents | 71b7e41a7415 |
children | 233c02d7607c |
comparison
equal
deleted
inserted
replaced
82467:ff85cbd27ee2 | 82468:4f98fbdaf9ce |
---|---|
1242 :group 'fancy-splash-screen | 1242 :group 'fancy-splash-screen |
1243 :type '(choice (const :tag "Default" nil) | 1243 :type '(choice (const :tag "Default" nil) |
1244 (file :tag "File"))) | 1244 (file :tag "File"))) |
1245 | 1245 |
1246 | 1246 |
1247 (defvar fancy-splash-keymap | 1247 (defvar splash-screen-keymap |
1248 (let ((map (make-sparse-keymap))) | 1248 (let ((map (make-sparse-keymap))) |
1249 (suppress-keymap map) | 1249 (suppress-keymap map) |
1250 (set-keymap-parent map button-buffer-map) | 1250 (set-keymap-parent map button-buffer-map) |
1251 | 1251 (define-key map "\C-?" 'scroll-down) |
1252 (define-key map " " 'fancy-splash-quit) | 1252 (define-key map " " 'scroll-up) |
1253 (define-key map "q" 'fancy-splash-quit) | 1253 (define-key map "q" 'exit-splash-screen) |
1254 map) | 1254 map) |
1255 "Keymap for splash screen buffer.") | 1255 "Keymap for splash screen buffer.") |
1256 | 1256 |
1257 ;; These are temporary storage areas for the splash screen display. | 1257 ;; These are temporary storage areas for the splash screen display. |
1258 | 1258 |
1311 ;; so that it is visible with a dark frame background. | 1311 ;; so that it is visible with a dark frame background. |
1312 (when (and (memq 'xpm img) | 1312 (when (and (memq 'xpm img) |
1313 (eq (frame-parameter nil 'background-mode) 'dark)) | 1313 (eq (frame-parameter nil 'background-mode) 'dark)) |
1314 (setq img (append img '(:color-symbols (("#000000" . "gray30")))))) | 1314 (setq img (append img '(:color-symbols (("#000000" . "gray30")))))) |
1315 | 1315 |
1316 ;; Insert the image with a help-echo and a keymap. | 1316 ;; Insert the image with a help-echo and a link. |
1317 (let ((map (make-sparse-keymap)) | 1317 (make-button (prog1 (point) (insert-image img)) (point) |
1318 (help-echo "mouse-2: browse http://www.gnu.org/")) | 1318 'face 'default |
1319 (define-key map [mouse-2] | 1319 'help-echo "mouse-2: browse http://www.gnu.org/" |
1320 (lambda () | 1320 'action (lambda (button) (browse-url "http://www.gnu.org/")) |
1321 (interactive) | 1321 'follow-link t) |
1322 (browse-url "http://www.gnu.org/") | |
1323 (throw 'exit nil))) | |
1324 (define-key map [down-mouse-2] 'ignore) | |
1325 (define-key map [up-mouse-2] 'ignore) | |
1326 (insert-image img (propertize "[image]" 'help-echo help-echo | |
1327 'keymap map))) | |
1328 (insert "\n")))) | 1322 (insert "\n")))) |
1329 (fancy-splash-insert | 1323 (fancy-splash-insert |
1330 :face '(variable-pitch :foreground "red") | 1324 :face '(variable-pitch :foreground "red") |
1331 (if (eq system-type 'gnu/linux) | 1325 (if (eq system-type 'gnu/linux) |
1332 "GNU Emacs is one component of the GNU/Linux operating system." | 1326 "GNU Emacs is one component of the GNU/Linux operating system." |
1406 (set-buffer-modified-p nil) | 1400 (set-buffer-modified-p nil) |
1407 (goto-char (point-min)) | 1401 (goto-char (point-min)) |
1408 (force-mode-line-update) | 1402 (force-mode-line-update) |
1409 (setq fancy-current-text (cdr fancy-current-text)))) | 1403 (setq fancy-current-text (cdr fancy-current-text)))) |
1410 | 1404 |
1411 (defun fancy-splash-quit () | 1405 (defun exit-splash-screen () |
1412 "Stop displaying the splash screen buffer." | 1406 "Stop displaying the splash screen buffer." |
1413 (interactive) | 1407 (interactive) |
1414 (if fancy-splash-outer-buffer | 1408 (if fancy-splash-outer-buffer |
1415 (throw 'exit nil) | 1409 (throw 'exit nil) |
1416 (kill-buffer (current-buffer)))) | 1410 (quit-window t))) |
1417 | 1411 |
1418 (defun fancy-splash-screens (&optional static) | 1412 (defun fancy-splash-screens (&optional static) |
1419 "Display fancy splash screens when Emacs starts." | 1413 "Display fancy splash screens when Emacs starts." |
1420 (if (not static) | 1414 (if (not static) |
1421 (let ((old-hourglass display-hourglass) | 1415 (let ((old-hourglass display-hourglass) |
1423 splash-buffer | 1417 splash-buffer |
1424 (frame (fancy-splash-frame)) | 1418 (frame (fancy-splash-frame)) |
1425 timer) | 1419 timer) |
1426 (save-selected-window | 1420 (save-selected-window |
1427 (select-frame frame) | 1421 (select-frame frame) |
1428 (switch-to-buffer " About GNU Emacs") | 1422 (switch-to-buffer "*About GNU Emacs*") |
1429 (make-local-variable 'cursor-type) | 1423 (make-local-variable 'cursor-type) |
1430 (setq splash-buffer (current-buffer)) | 1424 (setq splash-buffer (current-buffer)) |
1431 (catch 'stop-splashing | 1425 (catch 'stop-splashing |
1432 (unwind-protect | 1426 (unwind-protect |
1433 (let ((cursor-type nil)) | 1427 (let ((cursor-type nil)) |
1438 fancy-splash-stop-time (+ (float-time) | 1432 fancy-splash-stop-time (+ (float-time) |
1439 fancy-splash-max-time) | 1433 fancy-splash-max-time) |
1440 timer (run-with-timer 0 fancy-splash-delay | 1434 timer (run-with-timer 0 fancy-splash-delay |
1441 #'fancy-splash-screens-1 | 1435 #'fancy-splash-screens-1 |
1442 splash-buffer)) | 1436 splash-buffer)) |
1443 (use-local-map fancy-splash-keymap) | 1437 (use-local-map splash-screen-keymap) |
1444 (message "%s" (startup-echo-area-message)) | 1438 (message "%s" (startup-echo-area-message)) |
1445 (setq buffer-read-only t) | 1439 (setq buffer-read-only t) |
1446 (recursive-edit)) | 1440 (recursive-edit)) |
1447 (cancel-timer timer) | 1441 (cancel-timer timer) |
1448 (setq display-hourglass old-hourglass) | 1442 (setq display-hourglass old-hourglass) |
1449 (kill-buffer splash-buffer))))) | 1443 (kill-buffer splash-buffer))))) |
1450 ;; If static is non-nil, don't show fancy splash screen. | 1444 ;; If static is non-nil, don't show fancy splash screen. |
1451 (if (or (window-minibuffer-p) | 1445 (if (or (window-minibuffer-p) |
1452 (window-dedicated-p (selected-window))) | 1446 (window-dedicated-p (selected-window))) |
1453 (pop-to-buffer (current-buffer)) | 1447 (pop-to-buffer (current-buffer)) |
1454 (switch-to-buffer " GNU Emacs")) | 1448 (switch-to-buffer "*GNU Emacs*")) |
1455 (setq buffer-read-only nil) | 1449 (setq buffer-read-only nil) |
1456 (erase-buffer) | 1450 (erase-buffer) |
1457 (if pure-space-overflow | 1451 (if pure-space-overflow |
1458 (insert "\ | 1452 (insert "\ |
1459 Warning Warning!!! Pure space overflow !!!Warning Warning | 1453 Warning Warning!!! Pure space overflow !!!Warning Warning |
1465 (insert "\n")) | 1459 (insert "\n")) |
1466 (skip-chars-backward "\n") | 1460 (skip-chars-backward "\n") |
1467 (delete-region (point) (point-max)) | 1461 (delete-region (point) (point-max)) |
1468 (insert "\n") | 1462 (insert "\n") |
1469 (fancy-splash-tail) | 1463 (fancy-splash-tail) |
1470 (use-local-map fancy-splash-keymap) | 1464 (use-local-map splash-screen-keymap) |
1471 (set-buffer-modified-p nil) | 1465 (set-buffer-modified-p nil) |
1472 (setq buffer-read-only t) | 1466 (setq buffer-read-only t) |
1473 (if (and view-read-only (not view-mode)) | 1467 (if (and view-read-only (not view-mode)) |
1474 (view-mode-enter nil 'kill-buffer)) | 1468 (view-mode-enter nil 'kill-buffer)) |
1475 (goto-char (point-min))))) | 1469 (goto-char (point-min))))) |
1508 | 1502 |
1509 (defun normal-splash-screen (&optional static) | 1503 (defun normal-splash-screen (&optional static) |
1510 "Display splash screen when Emacs starts." | 1504 "Display splash screen when Emacs starts." |
1511 (let ((prev-buffer (current-buffer))) | 1505 (let ((prev-buffer (current-buffer))) |
1512 (unwind-protect | 1506 (unwind-protect |
1513 (with-current-buffer (get-buffer-create " About GNU Emacs") | 1507 (with-current-buffer (get-buffer-create "*About GNU Emacs*") |
1514 (setq buffer-read-only nil) | 1508 (setq buffer-read-only nil) |
1515 (erase-buffer) | 1509 (erase-buffer) |
1516 (set (make-local-variable 'tab-width) 8) | 1510 (set (make-local-variable 'tab-width) 8) |
1517 (if (not static) | 1511 (if (not static) |
1518 (set (make-local-variable 'mode-line-format) | 1512 (set (make-local-variable 'mode-line-format) |
1618 (eq (key-binding "\C-hi") 'info) | 1612 (eq (key-binding "\C-hi") 'info) |
1619 (eq (key-binding "\C-hr") 'info-emacs-manual) | 1613 (eq (key-binding "\C-hr") 'info-emacs-manual) |
1620 (eq (key-binding "\C-h\C-n") 'view-emacs-news)) | 1614 (eq (key-binding "\C-h\C-n") 'view-emacs-news)) |
1621 (insert " | 1615 (insert " |
1622 Get help C-h (Hold down CTRL and press h) | 1616 Get help C-h (Hold down CTRL and press h) |
1623 Emacs manual C-h r | 1617 Emacs manual C-h r Browse manuals C-h i |
1624 Emacs tutorial C-h t Undo changes C-x u | 1618 Emacs tutorial C-h t Undo changes C-x u |
1625 Buy manuals C-h C-m Exit Emacs C-x C-c | 1619 Buy manuals C-h C-m Exit Emacs C-x C-c") |
1626 Browse manuals C-h i") | |
1627 | 1620 |
1628 (insert (substitute-command-keys | 1621 (insert (substitute-command-keys |
1629 (format "\n | 1622 (format " |
1630 Get help %s | 1623 Get help %s |
1631 Emacs manual \\[info-emacs-manual] | 1624 Emacs manual \\[info-emacs-manual]\tBrowse manuals\t\\[info] |
1632 Emacs tutorial \\[help-with-tutorial]\tUndo changes\t\\[advertised-undo] | 1625 Emacs tutorial \\[help-with-tutorial]\tUndo changes\t\\[advertised-undo] |
1633 Buy manuals \\[view-order-manuals]\tExit Emacs\t\\[save-buffers-kill-emacs] | 1626 Buy manuals \\[view-order-manuals]\tExit Emacs\t\\[save-buffers-kill-emacs]" |
1634 Browse manuals \\[info]" | |
1635 (let ((where (where-is-internal | 1627 (let ((where (where-is-internal |
1636 'help-command nil t))) | 1628 'help-command nil t))) |
1637 (if where | 1629 (if where |
1638 (key-description where) | 1630 (key-description where) |
1639 "M-x help")))))) | 1631 "M-x help")))))) |
1650 (insert " | 1642 (insert " |
1651 \(`C-' means use the CTRL key. `M-' means use the Meta (or Alt) key. | 1643 \(`C-' means use the CTRL key. `M-' means use the Meta (or Alt) key. |
1652 If you have no Meta key, you may instead type ESC followed by the character.)") | 1644 If you have no Meta key, you may instead type ESC followed by the character.)") |
1653 | 1645 |
1654 ;; Insert links to useful tasks | 1646 ;; Insert links to useful tasks |
1655 (insert "\n\nUseful tasks (move point to the link and press RET):\n") | 1647 (insert "\nUseful tasks:\n") |
1648 | |
1656 (insert-button "Visit New File" | 1649 (insert-button "Visit New File" |
1657 'action (lambda (button) (call-interactively 'find-file)) | 1650 'action (lambda (button) (call-interactively 'find-file)) |
1658 'follow-link t) | 1651 'follow-link t) |
1659 (insert " Specify a new file's name, to edit the file\n") | 1652 (insert "\t\t\t") |
1660 (insert-button "Open Home Directory" | 1653 (insert-button "Open Home Directory" |
1661 'action (lambda (button) (dired "~")) | 1654 'action (lambda (button) (dired "~")) |
1662 'follow-link t) | 1655 'follow-link t) |
1663 (insert " Open your home directory, to operate on its files\n") | 1656 (insert "\n") |
1657 | |
1658 (insert-button "Customize Startup" | |
1659 'action (lambda (button) (customize-group 'initialization)) | |
1660 'follow-link t) | |
1661 (insert "\t\t") | |
1664 (insert-button "Open *scratch* buffer" | 1662 (insert-button "Open *scratch* buffer" |
1665 'action (lambda (button) (switch-to-buffer | 1663 'action (lambda (button) (switch-to-buffer |
1666 (get-buffer-create "*scratch*"))) | 1664 (get-buffer-create "*scratch*"))) |
1667 'follow-link t) | 1665 'follow-link t) |
1668 (insert " Open buffer for notes you don't want to save\n") | 1666 (insert "\n") |
1669 (insert-button "Customize Startup" | |
1670 'action (lambda (button) (customize-group 'initialization)) | |
1671 'follow-link t) | |
1672 (insert " Change initialization settings including this screen\n") | |
1673 | 1667 |
1674 (insert "\n" (emacs-version) | 1668 (insert "\n" (emacs-version) |
1675 "\n" emacs-copyright) | 1669 "\n" emacs-copyright) |
1676 | 1670 |
1677 (if (and (eq (key-binding "\C-h\C-c") 'describe-copying) | 1671 (if (and (eq (key-binding "\C-h\C-c") 'describe-copying) |
1709 t) | 1703 t) |
1710 (insert "\n\nIf an Emacs session crashed recently, " | 1704 (insert "\n\nIf an Emacs session crashed recently, " |
1711 "type Meta-x recover-session RET\nto recover" | 1705 "type Meta-x recover-session RET\nto recover" |
1712 " the files you were editing.\n")) | 1706 " the files you were editing.\n")) |
1713 | 1707 |
1714 (use-local-map button-buffer-map) | 1708 (use-local-map splash-screen-keymap) |
1715 | 1709 |
1716 ;; Display the input that we set up in the buffer. | 1710 ;; Display the input that we set up in the buffer. |
1717 (set-buffer-modified-p nil) | 1711 (set-buffer-modified-p nil) |
1718 (setq buffer-read-only t) | 1712 (setq buffer-read-only t) |
1719 (if (and view-read-only (not view-mode)) | 1713 (if (and view-read-only (not view-mode)) |
1733 (switch-to-buffer (current-buffer)) | 1727 (switch-to-buffer (current-buffer)) |
1734 ;; In case the window is dedicated or something. | 1728 ;; In case the window is dedicated or something. |
1735 (error (pop-to-buffer (current-buffer)))))) | 1729 (error (pop-to-buffer (current-buffer)))))) |
1736 ;; Unwind ... ensure splash buffer is killed | 1730 ;; Unwind ... ensure splash buffer is killed |
1737 (if (not static) | 1731 (if (not static) |
1738 (kill-buffer " About GNU Emacs") | 1732 (kill-buffer "*About GNU Emacs*") |
1739 (switch-to-buffer " About GNU Emacs") | 1733 (switch-to-buffer "*About GNU Emacs*") |
1740 (rename-buffer " GNU Emacs" t))))) | 1734 (rename-buffer "*GNU Emacs*" t))))) |
1741 | 1735 |
1742 | 1736 |
1743 (defun startup-echo-area-message () | 1737 (defun startup-echo-area-message () |
1744 (if (eq (key-binding "\C-h\C-p") 'describe-project) | 1738 (if (eq (key-binding "\C-h\C-p") 'describe-project) |
1745 "For information about the GNU system and GNU/Linux, type C-h C-p." | 1739 "For information about the GNU system and GNU/Linux, type C-h C-p." |