comparison lisp/startup.el @ 69785:d30038c6c061

(normal-splash-screen): Only set mode-line-format in the splash buffer, so as not to interfere when debugging the code. Ignore errors when switching buffer.
author Stefan Monnier <monnier@iro.umontreal.ca>
date Mon, 03 Apr 2006 22:16:05 +0000
parents 919e61a6e661
children 37d815169d7a
comparison
equal deleted inserted replaced
69784:2a84440a03fb 69785:d30038c6c061
1397 (defun normal-splash-screen () 1397 (defun normal-splash-screen ()
1398 "Display splash screen when Emacs starts." 1398 "Display splash screen when Emacs starts."
1399 (let ((prev-buffer (current-buffer))) 1399 (let ((prev-buffer (current-buffer)))
1400 (unwind-protect 1400 (unwind-protect
1401 (with-current-buffer (get-buffer-create "GNU Emacs") 1401 (with-current-buffer (get-buffer-create "GNU Emacs")
1402 (let ((tab-width 8) 1402 (set (make-local-variable 'tab-width) 8)
1403 (mode-line-format (propertize "---- %b %-" 1403 (set (make-local-variable 'mode-line-format)
1404 'face '(:weight bold)))) 1404 (propertize "---- %b %-" 'face '(:weight bold)))
1405 1405
1406 (if pure-space-overflow 1406 (if pure-space-overflow
1407 (insert "Warning Warning Pure space overflow Warning Warning\n")) 1407 (insert "Warning Warning Pure space overflow Warning Warning\n"))
1408 1408
1409 ;; The convention for this piece of code is that 1409 ;; The convention for this piece of code is that
1410 ;; each piece of output starts with one or two newlines 1410 ;; each piece of output starts with one or two newlines
1411 ;; and does not end with any newlines. 1411 ;; and does not end with any newlines.
1412 (insert "Welcome to GNU Emacs") 1412 (insert "Welcome to GNU Emacs")
1413 (insert 1413 (insert
1414 (if (eq system-type 'gnu/linux) 1414 (if (eq system-type 'gnu/linux)
1415 ", one component of the GNU/Linux operating system.\n" 1415 ", one component of the GNU/Linux operating system.\n"
1416 ", a part of the GNU operating system.\n")) 1416 ", a part of the GNU operating system.\n"))
1417 1417
1418 (unless (equal (buffer-name prev-buffer) "*scratch*") 1418 (unless (equal (buffer-name prev-buffer) "*scratch*")
1419 (insert (substitute-command-keys 1419 (insert (substitute-command-keys
1420 "\nType \\[recenter] to begin editing your file.\n"))) 1420 "\nType \\[recenter] to begin editing your file.\n")))
1421 1421
1422 (if (display-mouse-p) 1422 (if (display-mouse-p)
1423 ;; The user can use the mouse to activate menus 1423 ;; The user can use the mouse to activate menus
1424 ;; so give help in terms of menu items. 1424 ;; so give help in terms of menu items.
1425 (progn 1425 (progn
1426 (insert "\ 1426 (insert "\
1427 You can do basic editing with the menu bar and scroll bar using the mouse. 1427 You can do basic editing with the menu bar and scroll bar using the mouse.
1428 1428
1429 Useful File menu items: 1429 Useful File menu items:
1430 Exit Emacs (or type Control-x followed by Control-c) 1430 Exit Emacs (or type Control-x followed by Control-c)
1431 Recover Crashed Session Recover files you were editing before a crash 1431 Recover Crashed Session Recover files you were editing before a crash
1437 \(Non)Warranty GNU Emacs comes with ABSOLUTELY NO WARRANTY 1437 \(Non)Warranty GNU Emacs comes with ABSOLUTELY NO WARRANTY
1438 Copying Conditions Conditions for redistributing and changing Emacs 1438 Copying Conditions Conditions for redistributing and changing Emacs
1439 Getting New Versions How to obtain the latest version of Emacs 1439 Getting New Versions How to obtain the latest version of Emacs
1440 More Manuals / Ordering Manuals How to order printed manuals from the FSF 1440 More Manuals / Ordering Manuals How to order printed manuals from the FSF
1441 ") 1441 ")
1442 (insert "\n\n" (emacs-version) 1442 (insert "\n\n" (emacs-version)
1443 " 1443 "
1444 Copyright (C) 2006 Free Software Foundation, Inc.")) 1444 Copyright (C) 2006 Free Software Foundation, Inc."))
1445 1445
1446 ;; No mouse menus, so give help using kbd commands. 1446 ;; No mouse menus, so give help using kbd commands.
1447 1447
1448 ;; If keys have their default meanings, 1448 ;; If keys have their default meanings,
1449 ;; use precomputed string to save lots of time. 1449 ;; use precomputed string to save lots of time.
1450 (if (and (eq (key-binding "\C-h") 'help-command) 1450 (if (and (eq (key-binding "\C-h") 'help-command)
1451 (eq (key-binding "\C-xu") 'advertised-undo) 1451 (eq (key-binding "\C-xu") 'advertised-undo)
1452 (eq (key-binding "\C-x\C-c") 'save-buffers-kill-emacs) 1452 (eq (key-binding "\C-x\C-c") 'save-buffers-kill-emacs)
1453 (eq (key-binding "\C-ht") 'help-with-tutorial) 1453 (eq (key-binding "\C-ht") 'help-with-tutorial)
1454 (eq (key-binding "\C-hi") 'info) 1454 (eq (key-binding "\C-hi") 'info)
1455 (eq (key-binding "\C-hr") 'info-emacs-manual) 1455 (eq (key-binding "\C-hr") 'info-emacs-manual)
1456 (eq (key-binding "\C-h\C-n") 'view-emacs-news)) 1456 (eq (key-binding "\C-h\C-n") 'view-emacs-news))
1457 (insert " 1457 (insert "
1458 Get help C-h (Hold down CTRL and press h) 1458 Get help C-h (Hold down CTRL and press h)
1459 Emacs manual C-h r 1459 Emacs manual C-h r
1460 Emacs tutorial C-h t Undo changes C-x u 1460 Emacs tutorial C-h t Undo changes C-x u
1461 Buy manuals C-h C-m Exit Emacs C-x C-c 1461 Buy manuals C-h C-m Exit Emacs C-x C-c
1462 Browse manuals C-h i") 1462 Browse manuals C-h i")
1463 1463
1464 (insert (substitute-command-keys 1464 (insert (substitute-command-keys
1465 (format "\n 1465 (format "\n
1466 Get help %s 1466 Get help %s
1467 Emacs manual \\[info-emacs-manual] 1467 Emacs manual \\[info-emacs-manual]
1468 Emacs tutorial \\[help-with-tutorial]\tUndo changes\t\\[advertised-undo] 1468 Emacs tutorial \\[help-with-tutorial]\tUndo changes\t\\[advertised-undo]
1469 Buy manuals \\[view-order-manuals]\tExit Emacs\t\\[save-buffers-kill-emacs] 1469 Buy manuals \\[view-order-manuals]\tExit Emacs\t\\[save-buffers-kill-emacs]
1470 Browse manuals \\[info]" 1470 Browse manuals \\[info]"
1471 (let ((where (where-is-internal 1471 (let ((where (where-is-internal
1472 'help-command nil t))) 1472 'help-command nil t)))
1473 (if where 1473 (if where
1474 (key-description where) 1474 (key-description where)
1475 "M-x help")))))) 1475 "M-x help"))))))
1476 1476
1477 ;; Say how to use the menu bar with the keyboard. 1477 ;; Say how to use the menu bar with the keyboard.
1478 (if (and (eq (key-binding "\M-`") 'tmm-menubar) 1478 (if (and (eq (key-binding "\M-`") 'tmm-menubar)
1479 (eq (key-binding [f10]) 'tmm-menubar)) 1479 (eq (key-binding [f10]) 'tmm-menubar))
1480 (insert " 1480 (insert "
1481 Activate menubar F10 or ESC ` or M-`") 1481 Activate menubar F10 or ESC ` or M-`")
1482 (insert (substitute-command-keys " 1482 (insert (substitute-command-keys "
1483 Activate menubar \\[tmm-menubar]"))) 1483 Activate menubar \\[tmm-menubar]")))
1484 1484
1485 ;; Many users seem to have problems with these. 1485 ;; Many users seem to have problems with these.
1486 (insert " 1486 (insert "
1487 \(`C-' means use the CTRL key. `M-' means use the Meta (or Alt) key. 1487 \(`C-' means use the CTRL key. `M-' means use the Meta (or Alt) key.
1488 If you have no Meta key, you may instead type ESC followed by the character.)") 1488 If you have no Meta key, you may instead type ESC followed by the character.)")
1489 1489
1490 (insert "\n\n" (emacs-version) 1490 (insert "\n\n" (emacs-version)
1491 " 1491 "
1492 Copyright (C) 2006 Free Software Foundation, Inc.") 1492 Copyright (C) 2006 Free Software Foundation, Inc.")
1493 1493
1494 (if (and (eq (key-binding "\C-h\C-c") 'describe-copying) 1494 (if (and (eq (key-binding "\C-h\C-c") 'describe-copying)
1495 (eq (key-binding "\C-h\C-d") 'describe-distribution) 1495 (eq (key-binding "\C-h\C-d") 'describe-distribution)
1496 (eq (key-binding "\C-h\C-w") 'describe-no-warranty)) 1496 (eq (key-binding "\C-h\C-w") 'describe-no-warranty))
1497 (insert 1497 (insert
1498 "\n 1498 "\n
1499 GNU Emacs comes with ABSOLUTELY NO WARRANTY; type C-h C-w for full details. 1499 GNU Emacs comes with ABSOLUTELY NO WARRANTY; type C-h C-w for full details.
1500 Emacs is Free Software--Free as in Freedom--so you can redistribute copies 1500 Emacs is Free Software--Free as in Freedom--so you can redistribute copies
1501 of Emacs and modify it; type C-h C-c to see the conditions. 1501 of Emacs and modify it; type C-h C-c to see the conditions.
1502 Type C-h C-d for information on getting the latest version.") 1502 Type C-h C-d for information on getting the latest version.")
1503 (insert (substitute-command-keys 1503 (insert (substitute-command-keys
1504 "\n 1504 "\n
1505 GNU Emacs comes with ABSOLUTELY NO WARRANTY; type \\[describe-no-warranty] for full details. 1505 GNU Emacs comes with ABSOLUTELY NO WARRANTY; type \\[describe-no-warranty] for full details.
1506 Emacs is Free Software--Free as in Freedom--so you can redistribute copies 1506 Emacs is Free Software--Free as in Freedom--so you can redistribute copies
1507 of Emacs and modify it; type \\[describe-copying] to see the conditions. 1507 of Emacs and modify it; type \\[describe-copying] to see the conditions.
1508 Type \\[describe-distribution] for information on getting the latest version.")))) 1508 Type \\[describe-distribution] for information on getting the latest version."))))
1509 1509
1510 ;; The rest of the startup screen is the same on all 1510 ;; The rest of the startup screen is the same on all
1511 ;; kinds of terminals. 1511 ;; kinds of terminals.
1512 1512
1513 ;; Give information on recovering, if there was a crash. 1513 ;; Give information on recovering, if there was a crash.
1514 (and auto-save-list-file-prefix 1514 (and auto-save-list-file-prefix
1515 ;; Don't signal an error if the 1515 ;; Don't signal an error if the
1516 ;; directory for auto-save-list files 1516 ;; directory for auto-save-list files
1517 ;; does not yet exist. 1517 ;; does not yet exist.
1518 (file-directory-p (file-name-directory 1518 (file-directory-p (file-name-directory
1519 auto-save-list-file-prefix)) 1519 auto-save-list-file-prefix))
1520 (directory-files 1520 (directory-files
1521 (file-name-directory auto-save-list-file-prefix) 1521 (file-name-directory auto-save-list-file-prefix)
1522 nil 1522 nil
1523 (concat "\\`" 1523 (concat "\\`"
1524 (regexp-quote (file-name-nondirectory 1524 (regexp-quote (file-name-nondirectory
1525 auto-save-list-file-prefix))) 1525 auto-save-list-file-prefix)))
1526 t) 1526 t)
1527 (insert "\n\nIf an Emacs session crashed recently, " 1527 (insert "\n\nIf an Emacs session crashed recently, "
1528 "type M-x recover-session RET\nto recover" 1528 "type M-x recover-session RET\nto recover"
1529 " the files you were editing.")) 1529 " the files you were editing."))
1530 1530
1531 ;; Display the input that we set up in the buffer. 1531 ;; Display the input that we set up in the buffer.
1532 (set-buffer-modified-p nil) 1532 (set-buffer-modified-p nil)
1533 (goto-char (point-min)) 1533 (goto-char (point-min))
1534 (save-window-excursion 1534 (save-window-excursion
1535 (switch-to-buffer (current-buffer)) 1535 (condition-case nil
1536 (sit-for 120)))) 1536 (switch-to-buffer (current-buffer))
1537 ;; In case we're in a dedicated or minibuffer-only window.
1538 (error
1539 ;; There's no point is using pop-to-buffer since creating
1540 ;; a new frame will generate enough events that the
1541 ;; subsequent `sit-for' will immediately return anyway.
1542 ;; (pop-to-buffer (current-buffer))
1543 ))
1544 (sit-for 120)))
1537 ;; Unwind ... ensure splash buffer is killed 1545 ;; Unwind ... ensure splash buffer is killed
1538 (kill-buffer "GNU Emacs")))) 1546 (kill-buffer "GNU Emacs"))))
1539 1547
1540 1548
1541 (defun startup-echo-area-message () 1549 (defun startup-echo-area-message ()