comparison lisp/startup.el @ 83655:67f4cd925834

Fix 2007-08-21 merge conflicts.
author Juri Linkov <juri@jurta.org>
date Wed, 22 Aug 2007 23:45:47 +0000
parents 2a69b973fae2
children b2a46adb61f1
comparison
equal deleted inserted replaced
83654:e9a88d9f47fb 83655:67f4cd925834
1368 (set-buffer-modified-p nil) 1368 (set-buffer-modified-p nil)
1369 (goto-char (point-min)) 1369 (goto-char (point-min))
1370 (force-mode-line-update) 1370 (force-mode-line-update)
1371 (setq fancy-current-text (cdr fancy-current-text)))) 1371 (setq fancy-current-text (cdr fancy-current-text))))
1372 1372
1373 (defun fancy-splash-default-action ()
1374 "Stop displaying the splash screen buffer.
1375 This is an internal function used to turn off the splash screen after
1376 the user caused an input event by hitting a key or clicking with the
1377 mouse."
1378 (interactive)
1379 (if (and (memq 'down (event-modifiers last-command-event))
1380 (eq (posn-window (event-start last-command-event))
1381 (selected-window)))
1382 ;; This is a mouse-down event in the splash screen window.
1383 ;; Ignore it and consume the corresponding mouse-up event.
1384 (read-event)
1385 (push last-command-event unread-command-events))
1386 (throw 'exit nil))
1387
1388 (defun exit-splash-screen () 1373 (defun exit-splash-screen ()
1389 "Exit the splash screen." 1374 "Stop displaying the splash screen buffer."
1390 (if (get-buffer "*About GNU Emacs*") 1375 (if (get-buffer "*About GNU Emacs*")
1391 (throw 'stop-splashing nil) 1376 (throw 'stop-splashing nil)
1392 (quit-window t))) 1377 (quit-window t)))
1393
1394 (defun fancy-splash-delete-frame (frame)
1395 "Exit the splash screen after the frame is deleted."
1396 ;; We can not throw from `delete-frame-events', so we set up a timer
1397 ;; to exit the recursive edit as soon as Emacs is idle again.
1398 (if (frame-live-p frame)
1399 (run-at-time 0 nil 'exit-splash-screen)))
1400 1378
1401 (defun fancy-splash-screens (&optional static) 1379 (defun fancy-splash-screens (&optional static)
1402 "Display fancy splash screens when Emacs starts." 1380 "Display fancy splash screens when Emacs starts."
1403 (if (not static) 1381 (if (not static)
1404 (let ((old-hourglass display-hourglass) 1382 (let ((old-hourglass display-hourglass)
1411 (switch-to-buffer "*About GNU Emacs*") 1389 (switch-to-buffer "*About GNU Emacs*")
1412 (make-local-variable 'cursor-type) 1390 (make-local-variable 'cursor-type)
1413 (setq splash-buffer (current-buffer)) 1391 (setq splash-buffer (current-buffer))
1414 (catch 'stop-splashing 1392 (catch 'stop-splashing
1415 (unwind-protect 1393 (unwind-protect
1416 (let* ((map (make-sparse-keymap)) 1394 (let ((cursor-type nil))
1417 (cursor-type nil)
1418 (overriding-local-map map)
1419 ;; Catch if our frame is deleted; the delete-frame
1420 ;; event is unreliable and is handled by
1421 ;; `special-event-map' anyway.
1422 (delete-frame-functions (cons 'fancy-splash-delete-frame
1423 delete-frame-functions)))
1424 (define-key map [t] 'fancy-splash-default-action)
1425 (define-key map [mouse-movement] 'ignore)
1426 (define-key map [mode-line t] 'ignore)
1427 (define-key map [select-window] 'ignore)
1428 ;; Temporarily bind special events to
1429 ;; fancy-splash-special-event-action so as to stop
1430 ;; displaying splash screens with such events.
1431 ;; Otherwise, drag-n-drop into splash screens may
1432 ;; leave us in recursive editing with invisible
1433 ;; cursors for a while.
1434 (setq special-event-map (make-sparse-keymap))
1435 (map-keymap
1436 (lambda (key def)
1437 (define-key special-event-map (vector key)
1438 (if (eq def 'ignore)
1439 'ignore
1440 'fancy-splash-special-event-action)))
1441 old-special-event-map)
1442 (setq display-hourglass nil 1395 (setq display-hourglass nil
1443 buffer-undo-list t 1396 buffer-undo-list t
1444 mode-line-format (propertize "---- %b %-" 1397 mode-line-format (propertize "---- %b %-"
1445 'face 'mode-line-buffer-id) 1398 'face 'mode-line-buffer-id)
1446 fancy-splash-stop-time (+ (float-time) 1399 fancy-splash-stop-time (+ (float-time)
1452 (setq tab-width 22) 1405 (setq tab-width 22)
1453 (message "%s" (startup-echo-area-message)) 1406 (message "%s" (startup-echo-area-message))
1454 (setq buffer-read-only t) 1407 (setq buffer-read-only t)
1455 (recursive-edit)) 1408 (recursive-edit))
1456 (cancel-timer timer) 1409 (cancel-timer timer)
1457 (setq display-hourglass old-hourglass 1410 (setq display-hourglass old-hourglass)
1458 minor-mode-map-alist old-minor-mode-map-alist
1459 emulation-mode-map-alists old-emulation-mode-map-alists
1460 special-event-map old-special-event-map)
1461 (kill-buffer splash-buffer) 1411 (kill-buffer splash-buffer)
1462 (when (frame-live-p frame) 1412 (when (frame-live-p frame)
1463 (select-frame frame) 1413 (select-frame frame)
1464 (switch-to-buffer fancy-splash-outer-buffer)) 1414 (switch-to-buffer fancy-splash-outer-buffer))))))
1465 (when fancy-splash-last-input-event 1415 ;; If static is non-nil, don't show fancy splash screen.
1466 (setq last-input-event fancy-splash-last-input-event
1467 fancy-splash-last-input-event nil)
1468 (command-execute (lookup-key special-event-map
1469 (vector last-input-event))
1470 nil (vector last-input-event) t))))))
1471 ;; If hide-on-input is nil, don't hide the buffer on input.
1472 (if (or (window-minibuffer-p) 1416 (if (or (window-minibuffer-p)
1473 (window-dedicated-p (selected-window))) 1417 (window-dedicated-p (selected-window)))
1474 (pop-to-buffer (current-buffer)) 1418 (pop-to-buffer (current-buffer))
1475 (switch-to-buffer "*GNU Emacs*")) 1419 (switch-to-buffer "*GNU Emacs*"))
1476 (setq buffer-read-only nil) 1420 (setq buffer-read-only nil)
1493 (set-buffer-modified-p nil) 1437 (set-buffer-modified-p nil)
1494 (setq buffer-read-only t) 1438 (setq buffer-read-only t)
1495 (if (and view-read-only (not view-mode)) 1439 (if (and view-read-only (not view-mode))
1496 (view-mode-enter nil 'kill-buffer)) 1440 (view-mode-enter nil 'kill-buffer))
1497 (goto-char (point-min))))) 1441 (goto-char (point-min)))))
1498
1499 (defun fancy-splash-special-event-action ()
1500 "Save the last event and stop displaying the splash screen buffer.
1501 This is an internal function used to turn off the splash screen after
1502 the user caused an input event that is bound in `special-event-map'"
1503 (interactive)
1504 (setq fancy-splash-last-input-event last-input-event)
1505 (throw 'exit nil))
1506
1507 1442
1508 (defun fancy-splash-frame () 1443 (defun fancy-splash-frame ()
1509 "Return the frame to use for the fancy splash screen. 1444 "Return the frame to use for the fancy splash screen.
1510 Returning non-nil does not mean we should necessarily 1445 Returning non-nil does not mean we should necessarily
1511 use the fancy splash screen, but if we do use it, 1446 use the fancy splash screen, but if we do use it,
1660 (insert-button "Buy manuals" 1595 (insert-button "Buy manuals"
1661 'action (lambda (button) (view-order-manuals)) 1596 'action (lambda (button) (view-order-manuals))
1662 'follow-link t) 1597 'follow-link t)
1663 (insert "\t C-h C-m\tExit Emacs\t C-x C-c")) 1598 (insert "\t C-h C-m\tExit Emacs\t C-x C-c"))
1664 1599
1665 (insert (substitute-command-keys 1600 (insert (format "
1666 (format "\n
1667 Get help %s 1601 Get help %s
1668 " 1602 "
1669 (let ((where (where-is-internal 1603 (let ((where (where-is-internal
1670 'help-command nil t))) 1604 'help-command nil t)))
1671 (if where 1605 (if where
1688 ")) 1622 "))
1689 (insert-button "Buy manuals" 1623 (insert-button "Buy manuals"
1690 'action (lambda (button) (view-order-manuals)) 1624 'action (lambda (button) (view-order-manuals))
1691 'follow-link t) 1625 'follow-link t)
1692 (insert (substitute-command-keys 1626 (insert (substitute-command-keys
1693 "\t \\[view-order-manuals]\tExit Emacs\t \\[save-buffers-kill-emacs]"))) 1627 "\t \\[view-order-manuals]\tExit Emacs\t \\[save-buffers-kill-terminal]")))
1694 1628
1695 ;; Say how to use the menu bar with the keyboard. 1629 ;; Say how to use the menu bar with the keyboard.
1696 (insert "\n") 1630 (insert "\n")
1697 (insert-button "Activate menubar" 1631 (insert-button "Activate menubar"
1698 'action (lambda (button) (tmm-menubar)) 1632 'action (lambda (button) (tmm-menubar))
1800 (set-buffer-modified-p nil) 1734 (set-buffer-modified-p nil)
1801 (setq buffer-read-only t) 1735 (setq buffer-read-only t)
1802 (if (and view-read-only (not view-mode)) 1736 (if (and view-read-only (not view-mode))
1803 (view-mode-enter nil 'kill-buffer)) 1737 (view-mode-enter nil 'kill-buffer))
1804 (goto-char (point-min)) 1738 (goto-char (point-min))
1805 (if hide-on-input 1739 (if (not static)
1806 (if (or (window-minibuffer-p) 1740 (if (or (window-minibuffer-p)
1807 (window-dedicated-p (selected-window))) 1741 (window-dedicated-p (selected-window)))
1808 ;; If hide-on-input is nil, creating a new frame will 1742 ;; If static is nil, creating a new frame will
1809 ;; generate enough events that the subsequent `sit-for' 1743 ;; generate enough events that the subsequent `sit-for'
1810 ;; will immediately return anyway. 1744 ;; will immediately return anyway.
1811 nil ;; (pop-to-buffer (current-buffer)) 1745 nil ;; (pop-to-buffer (current-buffer))
1812 (save-window-excursion 1746 (save-window-excursion
1813 (switch-to-buffer (current-buffer)) 1747 (switch-to-buffer (current-buffer))
1879 With a prefix argument, any user input hides the splash screen." 1813 With a prefix argument, any user input hides the splash screen."
1880 (interactive "P") 1814 (interactive "P")
1881 ;; Prevent recursive calls from server-process-filter. 1815 ;; Prevent recursive calls from server-process-filter.
1882 (if (not (get-buffer "*About GNU Emacs*")) 1816 (if (not (get-buffer "*About GNU Emacs*"))
1883 (if (use-fancy-splash-screens-p) 1817 (if (use-fancy-splash-screens-p)
1884 (fancy-splash-screens hide-on-input) 1818 (fancy-splash-screens static)
1885 (normal-splash-screen hide-on-input)))) 1819 (normal-splash-screen static))))
1820
1821 (defalias 'about-emacs 'display-splash-screen)
1886 1822
1887 (defun command-line-1 (command-line-args-left) 1823 (defun command-line-1 (command-line-args-left)
1888 (display-startup-echo-area-message) 1824 (display-startup-echo-area-message)
1889 1825
1890 ;; Delay 2 seconds after an init file error message 1826 ;; Delay 2 seconds after an init file error message