aboutsummaryrefslogtreecommitdiffstats
path: root/lisp/startup.el
diff options
context:
space:
mode:
Diffstat (limited to 'lisp/startup.el')
-rw-r--r--lisp/startup.el185
1 files changed, 109 insertions, 76 deletions
diff --git a/lisp/startup.el b/lisp/startup.el
index 5a6b4089770..b96503603c2 100644
--- a/lisp/startup.el
+++ b/lisp/startup.el
@@ -1249,11 +1249,16 @@ where FACE is a valid face specification, as it can be used with
1249 "GNU Emacs is one component of the GNU/Linux operating system." 1249 "GNU Emacs is one component of the GNU/Linux operating system."
1250 "GNU Emacs is one component of the GNU operating system.")) 1250 "GNU Emacs is one component of the GNU operating system."))
1251 (insert "\n") 1251 (insert "\n")
1252 (unless (equal (buffer-name fancy-splash-outer-buffer) "*scratch*") 1252 (if fancy-splash-outer-buffer
1253 (fancy-splash-insert :face 'variable-pitch 1253 (fancy-splash-insert
1254 (substitute-command-keys 1254 :face 'variable-pitch
1255 "Type \\[recenter] to begin editing your file.\n")))) 1255 (substitute-command-keys
1256 1256 (concat
1257 "Type \\[recenter] to begin editing"
1258 (if (equal (buffer-name fancy-splash-outer-buffer)
1259 "*scratch*")
1260 ".\n"
1261 " your file.\n"))))))
1257 1262
1258(defun fancy-splash-tail () 1263(defun fancy-splash-tail ()
1259 "Insert the tail part of the splash screen into the current buffer." 1264 "Insert the tail part of the splash screen into the current buffer."
@@ -1333,55 +1338,74 @@ mouse."
1333 (if (frame-live-p frame) 1338 (if (frame-live-p frame)
1334 (run-at-time 0 nil 'fancy-splash-exit))) 1339 (run-at-time 0 nil 'fancy-splash-exit)))
1335 1340
1336(defun fancy-splash-screens () 1341(defun fancy-splash-screens (&optional hide-on-input)
1337 "Display fancy splash screens when Emacs starts." 1342 "Display fancy splash screens when Emacs starts."
1338 (setq fancy-splash-help-echo (startup-echo-area-message)) 1343 (setq fancy-splash-help-echo (startup-echo-area-message))
1339 (let ((old-hourglass display-hourglass) 1344 (if hide-on-input
1340 (fancy-splash-outer-buffer (current-buffer)) 1345 (let ((old-hourglass display-hourglass)
1341 splash-buffer 1346 (fancy-splash-outer-buffer (current-buffer))
1342 (old-minor-mode-map-alist minor-mode-map-alist) 1347 splash-buffer
1343 (old-emulation-mode-map-alists emulation-mode-map-alists) 1348 (old-minor-mode-map-alist minor-mode-map-alist)
1344 (frame (fancy-splash-frame)) 1349 (old-emulation-mode-map-alists emulation-mode-map-alists)
1345 timer) 1350 (frame (fancy-splash-frame))
1346 (save-selected-window 1351 timer)
1347 (select-frame frame) 1352 (save-selected-window
1348 (switch-to-buffer "GNU Emacs") 1353 (select-frame frame)
1349 (setq tab-width 20) 1354 (switch-to-buffer "GNU Emacs")
1350 (setq splash-buffer (current-buffer)) 1355 (setq tab-width 20)
1351 (catch 'stop-splashing 1356 (setq splash-buffer (current-buffer))
1352 (unwind-protect 1357 (catch 'stop-splashing
1353 (let* ((map (make-sparse-keymap)) 1358 (unwind-protect
1354 (overriding-local-map map) 1359 (let* ((map (make-sparse-keymap))
1355 ;; Catch if our frame is deleted; the delete-frame 1360 (overriding-local-map map)
1356 ;; event is unreliable and is handled by 1361 ;; Catch if our frame is deleted; the delete-frame
1357 ;; `special-event-map' anyway. 1362 ;; event is unreliable and is handled by
1358 (delete-frame-functions (cons 'fancy-splash-delete-frame 1363 ;; `special-event-map' anyway.
1359 delete-frame-functions))) 1364 (delete-frame-functions (cons 'fancy-splash-delete-frame
1360 (define-key map [t] 'fancy-splash-default-action) 1365 delete-frame-functions)))
1361 (define-key map [mouse-movement] 'ignore) 1366 (define-key map [t] 'fancy-splash-default-action)
1362 (define-key map [mode-line t] 'ignore) 1367 (define-key map [mouse-movement] 'ignore)
1363 (define-key map [select-window] 'ignore) 1368 (define-key map [mode-line t] 'ignore)
1364 (setq cursor-type nil 1369 (define-key map [select-window] 'ignore)
1365 display-hourglass nil 1370 (setq cursor-type nil
1366 minor-mode-map-alist nil 1371 display-hourglass nil
1367 emulation-mode-map-alists nil 1372 minor-mode-map-alist nil
1368 buffer-undo-list t 1373 emulation-mode-map-alists nil
1369 mode-line-format (propertize "---- %b %-" 1374 buffer-undo-list t
1370 'face 'mode-line-buffer-id) 1375 mode-line-format (propertize "---- %b %-"
1371 fancy-splash-stop-time (+ (float-time) 1376 'face 'mode-line-buffer-id)
1372 fancy-splash-max-time) 1377 fancy-splash-stop-time (+ (float-time)
1373 timer (run-with-timer 0 fancy-splash-delay 1378 fancy-splash-max-time)
1374 #'fancy-splash-screens-1 1379 timer (run-with-timer 0 fancy-splash-delay
1375 splash-buffer)) 1380 #'fancy-splash-screens-1
1376 (recursive-edit)) 1381 splash-buffer))
1377 (cancel-timer timer) 1382 (recursive-edit))
1378 (setq display-hourglass old-hourglass 1383 (cancel-timer timer)
1379 minor-mode-map-alist old-minor-mode-map-alist 1384 (setq display-hourglass old-hourglass
1380 emulation-mode-map-alists old-emulation-mode-map-alists) 1385 minor-mode-map-alist old-minor-mode-map-alist
1381 (kill-buffer splash-buffer) 1386 emulation-mode-map-alists old-emulation-mode-map-alists)
1382 (when (frame-live-p frame) 1387 (kill-buffer splash-buffer)
1383 (select-frame frame) 1388 (when (frame-live-p frame)
1384 (switch-to-buffer fancy-splash-outer-buffer))))))) 1389 (select-frame frame)
1390 (switch-to-buffer fancy-splash-outer-buffer))))))
1391 ;; If hide-on-input is non-nil, don't hide the buffer on input.
1392 (if (or (window-minibuffer-p)
1393 (window-dedicated-p (selected-window)))
1394 (pop-to-buffer (current-buffer))
1395 (switch-to-buffer "GNU Emacs"))
1396 (erase-buffer)
1397 (if pure-space-overflow
1398 (insert "\
1399Warning Warning!!! Pure space overflow !!!Warning Warning
1400\(See the node Pure Storage in the Lisp manual for details.)\n"))
1401 (let (fancy-splash-outer-buffer)
1402 (fancy-splash-head)
1403 (dolist (text fancy-splash-text)
1404 (apply #'fancy-splash-insert text))
1405 (fancy-splash-tail)
1406 (set-buffer-modified-p nil)
1407 (goto-char (point-min)))))
1408
1385 1409
1386(defun fancy-splash-frame () 1410(defun fancy-splash-frame ()
1387 "Return the frame to use for the fancy splash screen. 1411 "Return the frame to use for the fancy splash screen.
@@ -1412,14 +1436,16 @@ we put it on this frame."
1412 (> window-height (+ image-height 19))))))) 1436 (> window-height (+ image-height 19)))))))
1413 1437
1414 1438
1415(defun normal-splash-screen () 1439(defun normal-splash-screen (&optional hide-on-input)
1416 "Display splash screen when Emacs starts." 1440 "Display splash screen when Emacs starts."
1417 (let ((prev-buffer (current-buffer))) 1441 (let ((prev-buffer (current-buffer)))
1418 (unwind-protect 1442 (unwind-protect
1419 (with-current-buffer (get-buffer-create "GNU Emacs") 1443 (with-current-buffer (get-buffer-create "GNU Emacs")
1444 (erase-buffer)
1420 (set (make-local-variable 'tab-width) 8) 1445 (set (make-local-variable 'tab-width) 8)
1421 (set (make-local-variable 'mode-line-format) 1446 (if hide-on-input
1422 (propertize "---- %b %-" 'face 'mode-line-buffer-id)) 1447 (set (make-local-variable 'mode-line-format)
1448 (propertize "---- %b %-" 'face 'mode-line-buffer-id)))
1423 1449
1424 (if pure-space-overflow 1450 (if pure-space-overflow
1425 (insert "\ 1451 (insert "\
@@ -1435,9 +1461,13 @@ Warning Warning!!! Pure space overflow !!!Warning Warning
1435 ", one component of the GNU/Linux operating system.\n" 1461 ", one component of the GNU/Linux operating system.\n"
1436 ", a part of the GNU operating system.\n")) 1462 ", a part of the GNU operating system.\n"))
1437 1463
1438 (unless (equal (buffer-name prev-buffer) "*scratch*") 1464 (if hide-on-input
1439 (insert (substitute-command-keys 1465 (insert (substitute-command-keys
1440 "\nType \\[recenter] to begin editing your file.\n"))) 1466 (concat
1467 "\nType \\[recenter] to begin editing"
1468 (if (equal (buffer-name prev-buffer) "*scratch*")
1469 ".\n"
1470 " your file.\n")))))
1441 1471
1442 (if (display-mouse-p) 1472 (if (display-mouse-p)
1443 ;; The user can use the mouse to activate menus 1473 ;; The user can use the mouse to activate menus
@@ -1548,20 +1578,23 @@ Type \\[describe-distribution] for information on getting the latest version."))
1548 "type M-x recover-session RET\nto recover" 1578 "type M-x recover-session RET\nto recover"
1549 " the files you were editing.")) 1579 " the files you were editing."))
1550 1580
1551 ;; Display the input that we set up in the buffer. 1581 ;; Display the input that we set up in the buffer.
1552 (set-buffer-modified-p nil) 1582 (set-buffer-modified-p nil)
1553 (goto-char (point-min)) 1583 (goto-char (point-min))
1554 (if (or (window-minibuffer-p) 1584 (if (or (window-minibuffer-p)
1555 (window-dedicated-p (selected-window))) 1585 (window-dedicated-p (selected-window)))
1556 ;; There's no point is using pop-to-buffer since creating 1586 ;; If hide-on-input is nil, creating a new frame will
1557 ;; a new frame will generate enough events that the 1587 ;; generate enough events that the subsequent `sit-for'
1558 ;; subsequent `sit-for' will immediately return anyway. 1588 ;; will immediately return anyway.
1559 nil ;; (pop-to-buffer (current-buffer)) 1589 (pop-to-buffer (current-buffer))
1560 (save-window-excursion 1590 (if hide-on-input
1561 (switch-to-buffer (current-buffer)) 1591 (save-window-excursion
1562 (sit-for 120)))) 1592 (switch-to-buffer (current-buffer))
1563 ;; Unwind ... ensure splash buffer is killed 1593 (sit-for 120))
1564 (kill-buffer "GNU Emacs")))) 1594 (switch-to-buffer (current-buffer)))))
1595 ;; Unwind ... ensure splash buffer is killed
1596 (if hide-on-input
1597 (kill-buffer "GNU Emacs")))))
1565 1598
1566 1599
1567(defun startup-echo-area-message () 1600(defun startup-echo-area-message ()
@@ -1615,7 +1648,7 @@ Type \\[describe-distribution] for information on getting the latest version."))
1615 (message "%s" (startup-echo-area-message)))))) 1648 (message "%s" (startup-echo-area-message))))))
1616 1649
1617 1650
1618(defun display-splash-screen () 1651(defun display-splash-screen (&optional hide-on-input)
1619 "Display splash screen according to display. 1652 "Display splash screen according to display.
1620Fancy splash screens are used on graphic displays, 1653Fancy splash screens are used on graphic displays,
1621normal otherwise." 1654normal otherwise."
@@ -1623,8 +1656,8 @@ normal otherwise."
1623 ;; Prevent recursive calls from server-process-filter. 1656 ;; Prevent recursive calls from server-process-filter.
1624 (if (not (get-buffer "GNU Emacs")) 1657 (if (not (get-buffer "GNU Emacs"))
1625 (if (use-fancy-splash-screens-p) 1658 (if (use-fancy-splash-screens-p)
1626 (fancy-splash-screens) 1659 (fancy-splash-screens hide-on-input)
1627 (normal-splash-screen)))) 1660 (normal-splash-screen hide-on-input))))
1628 1661
1629(defun command-line-1 (command-line-args-left) 1662(defun command-line-1 (command-line-args-left)
1630 (display-startup-echo-area-message) 1663 (display-startup-echo-area-message)
@@ -1888,7 +1921,7 @@ normal otherwise."
1888 ;; If user typed input during all that work, 1921 ;; If user typed input during all that work,
1889 ;; abort the startup screen. Otherwise, display it now. 1922 ;; abort the startup screen. Otherwise, display it now.
1890 (unless (input-pending-p) 1923 (unless (input-pending-p)
1891 (display-splash-screen)))) 1924 (display-splash-screen t))))
1892 1925
1893 1926
1894(defun command-line-normalize-file-name (file) 1927(defun command-line-normalize-file-name (file)