aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKaroly Lorentey2005-12-30 05:30:57 +0000
committerKaroly Lorentey2005-12-30 05:30:57 +0000
commit526039df1cd827ba428597b42046fe2b28d170c7 (patch)
tree119e146d30382190cfff6e3ee02375a26a0ee84a
parent4a0e3f08607bbe80ad9dee2c441286f6ad695d0a (diff)
downloademacs-526039df1cd827ba428597b42046fe2b28d170c7.tar.gz
emacs-526039df1cd827ba428597b42046fe2b28d170c7.zip
Enhance splash screens to work better with emacsclient.
* lisp/startup.el (fancy-splash-screens): Use `overriding-terminal-local-map' to set up keymap. Install a `delete-frame-functions' hook to catch `delete-frame' events. Ignore `select-window' events to cope better with `focus-follows-mouse'. Don't switch back to the original buffer if the splash frame has been killed. (normal-splash-screen): Don't let-bind `mode-line-format'; it changes the global binding---setq it instead. (display-splash-screen): Don't do anything if the splash screen is already displayed elsewhere. (fancy-splash-exit, fancy-splash-delete-frame): New functions. git-archimport-id: lorentey@elte.hu--2004/emacs--multi-tty--0--patch-477
-rw-r--r--README.multi-tty32
-rw-r--r--lisp/startup.el43
2 files changed, 62 insertions, 13 deletions
diff --git a/README.multi-tty b/README.multi-tty
index f1a0cde7df4..de9b53b04e4 100644
--- a/README.multi-tty
+++ b/README.multi-tty
@@ -401,6 +401,31 @@ is probably not very interesting for anyone else.)
401THINGS TO DO 401THINGS TO DO
402------------ 402------------
403 403
404** `delete-frame' events are handled by `special-event-map'
405 immediately when read by `read_char'. This is fine but it prevents
406 higher-level keymaps from binding that event to get notified of the
407 deleted frame.
408
409 Sometimes it would be useful for Lisp code to be notified of frame
410 deletions after they have happened, usually because they want to
411 clean up after the deleted frame. Not all frame-local states can
412 be stored as a frame parameter. For example,
413 `display-splash-screen' uses `recursive-edit' with a special keymap
414 override to create its buffer---and it leads to all kinds of
415 nastiness if Emacs stays in this recursive edit mode after the
416 frame containing the splash screen is deleted. Basically, the
417 splash-screen implementation wants to throw out of the recursive
418 edit when the frame is deleted; however, it is not legal to throw
419 from `delete-frame-functions' because `delete-frame' must not fail.
420 (Introducing `delete-frame-after-functions' would not help either
421 because `delete-frame' may not fail at that time either.)
422
423 Currently `fancy-splash-screens' installs a
424 `delete-frame-functions' hook that sets up a timer to exit the
425 recursive edit. This is an adequate solution, but it would perhaps
426 be better to have something like a `frame-deleted' event that could
427 be bound in the normal way.
428
404** Trouble: `setenv' doesn't actually set environment variables in the 429** Trouble: `setenv' doesn't actually set environment variables in the
405 Emacs process. This defeats the purpose of the elaborate 430 Emacs process. This defeats the purpose of the elaborate
406 `server-with-environment' magic around the `tgetent' call in 431 `server-with-environment' magic around the `tgetent' call in
@@ -1377,5 +1402,12 @@ DIARY OF CHANGES
1377 environment lists are now stored as frame parameters, so the 1402 environment lists are now stored as frame parameters, so the
1378 C-level terminal parameters are not strictly necessary any more.) 1403 C-level terminal parameters are not strictly necessary any more.)
1379 1404
1405-- `Fdelete_frame' is called from various critical places where it is
1406 not acceptable for the frame deletion to fail, e.g. from
1407 x_connection_closed after an X error. `Fdelete_frame' now protects
1408 against `delete-frame-functions' throwing an error and preventing a
1409 frame delete. (patch-475)
1410
1411
1380;;; arch-tag: 8da1619e-2e79-41a8-9ac9-a0485daad17d 1412;;; arch-tag: 8da1619e-2e79-41a8-9ac9-a0485daad17d
1381 1413
diff --git a/lisp/startup.el b/lisp/startup.el
index 651bbb4d33d..6ae2163687a 100644
--- a/lisp/startup.el
+++ b/lisp/startup.el
@@ -1290,7 +1290,6 @@ where FACE is a valid face specification, as it can be used with
1290 (force-mode-line-update) 1290 (force-mode-line-update)
1291 (setq fancy-current-text (cdr fancy-current-text)))) 1291 (setq fancy-current-text (cdr fancy-current-text))))
1292 1292
1293
1294(defun fancy-splash-default-action () 1293(defun fancy-splash-default-action ()
1295 "Stop displaying the splash screen buffer. 1294 "Stop displaying the splash screen buffer.
1296This is an internal function used to turn off the splash screen after 1295This is an internal function used to turn off the splash screen after
@@ -1306,6 +1305,17 @@ mouse."
1306 (push last-command-event unread-command-events)) 1305 (push last-command-event unread-command-events))
1307 (throw 'exit nil)) 1306 (throw 'exit nil))
1308 1307
1308(defun fancy-splash-exit ()
1309 "Exit the splash screen."
1310 (if (get-buffer "GNU Emacs")
1311 (throw 'stop-splashing nil)))
1312
1313(defun fancy-splash-delete-frame (frame)
1314 "Exit the splash screen after the frame is deleted."
1315 ;; We can not throw from `delete-frame-events', so we set up a timer
1316 ;; to exit the recursive edit as soon as Emacs is idle again.
1317 (if (frame-live-p frame)
1318 (run-at-time 0 nil 'fancy-splash-exit)))
1309 1319
1310(defun fancy-splash-screens () 1320(defun fancy-splash-screens ()
1311 "Display fancy splash screens when Emacs starts." 1321 "Display fancy splash screens when Emacs starts."
@@ -1323,12 +1333,17 @@ mouse."
1323 (setq splash-buffer (current-buffer)) 1333 (setq splash-buffer (current-buffer))
1324 (catch 'stop-splashing 1334 (catch 'stop-splashing
1325 (unwind-protect 1335 (unwind-protect
1326 (let ((map (make-sparse-keymap))) 1336 (let* ((map (make-sparse-keymap))
1327 (use-local-map map) 1337 (overriding-terminal-local-map map)
1328 (define-key map [switch-frame] 'ignore) 1338 ;; Catch if our frame is deleted; the delete-frame
1339 ;; event is unreliable and is handled by
1340 ;; `special-event-map' anyway.
1341 (delete-frame-functions (cons 'fancy-splash-delete-frame
1342 delete-frame-functions)))
1329 (define-key map [t] 'fancy-splash-default-action) 1343 (define-key map [t] 'fancy-splash-default-action)
1330 (define-key map [mouse-movement] 'ignore) 1344 (define-key map [mouse-movement] 'ignore)
1331 (define-key map [mode-line t] 'ignore) 1345 (define-key map [mode-line t] 'ignore)
1346 (define-key map [select-window] 'ignore)
1332 (setq cursor-type nil 1347 (setq cursor-type nil
1333 display-hourglass nil 1348 display-hourglass nil
1334 minor-mode-map-alist nil 1349 minor-mode-map-alist nil
@@ -1345,7 +1360,9 @@ mouse."
1345 (setq display-hourglass old-hourglass 1360 (setq display-hourglass old-hourglass
1346 minor-mode-map-alist old-minor-mode-map-alist) 1361 minor-mode-map-alist old-minor-mode-map-alist)
1347 (kill-buffer splash-buffer) 1362 (kill-buffer splash-buffer)
1348 (switch-to-buffer fancy-splash-outer-buffer)))))) 1363 (when (frame-live-p frame)
1364 (select-frame frame)
1365 (switch-to-buffer fancy-splash-outer-buffer)))))))
1349 1366
1350(defun fancy-splash-frame () 1367(defun fancy-splash-frame ()
1351 "Return the frame to use for the fancy splash screen. 1368 "Return the frame to use for the fancy splash screen.
@@ -1381,10 +1398,9 @@ we put it on this frame."
1381 (let ((prev-buffer (current-buffer))) 1398 (let ((prev-buffer (current-buffer)))
1382 (unwind-protect 1399 (unwind-protect
1383 (with-current-buffer (get-buffer-create "GNU Emacs") 1400 (with-current-buffer (get-buffer-create "GNU Emacs")
1384 (let ((tab-width 8) 1401 (setq mode-line-format (propertize "---- %b %-"
1385 (mode-line-format (propertize "---- %b %-" 1402 'face '(:weight bold)))
1386 'face '(:weight bold)))) 1403 (let ((tab-width 8))
1387
1388 (if pure-space-overflow 1404 (if pure-space-overflow
1389 (insert "Warning Warning Pure space overflow Warning Warning\n")) 1405 (insert "Warning Warning Pure space overflow Warning Warning\n"))
1390 1406
@@ -1538,10 +1554,11 @@ Type \\[describe-distribution] for information on getting the latest version."))
1538Fancy splash screens are used on graphic displays, 1554Fancy splash screens are used on graphic displays,
1539normal otherwise." 1555normal otherwise."
1540 (interactive) 1556 (interactive)
1541 (if (use-fancy-splash-screens-p) 1557 ;; Prevent recursive calls from server-process-filter.
1542 (fancy-splash-screens) 1558 (if (not (get-buffer "GNU Emacs"))
1543 (normal-splash-screen))) 1559 (if (use-fancy-splash-screens-p)
1544 1560 (fancy-splash-screens)
1561 (normal-splash-screen))))
1545 1562
1546(defun command-line-1 (command-line-args-left) 1563(defun command-line-1 (command-line-args-left)
1547 (or noninteractive (input-pending-p) init-file-had-error 1564 (or noninteractive (input-pending-p) init-file-had-error