diff options
| author | YAMAMOTO Mitsuharu | 2006-12-25 08:18:09 +0000 |
|---|---|---|
| committer | YAMAMOTO Mitsuharu | 2006-12-25 08:18:09 +0000 |
| commit | d3f4ab736a79aa886c6f744fcbe79b04edbec01f (patch) | |
| tree | 499cdeabf7d71f4c97fdc54abb507cb2c57a6bb9 | |
| parent | 92ad3e9f498c5c2adcc11503f46b09adf312227d (diff) | |
| download | emacs-d3f4ab736a79aa886c6f744fcbe79b04edbec01f.tar.gz emacs-d3f4ab736a79aa886c6f744fcbe79b04edbec01f.zip | |
(fancy-splash-last-input-event): New variable.
(fancy-splash-special-event-action): New function.
(fancy-splash-screens): Temporarily bind special events to it.
Execute command for saved special event before exiting from
recursive editing.
| -rw-r--r-- | lisp/startup.el | 35 |
1 files changed, 33 insertions, 2 deletions
diff --git a/lisp/startup.el b/lisp/startup.el index 8d1c254d7a1..1efbea5666e 100644 --- a/lisp/startup.el +++ b/lisp/startup.el | |||
| @@ -1205,6 +1205,7 @@ Values less than twice `fancy-splash-delay' are ignored." | |||
| 1205 | (defvar fancy-splash-help-echo nil) | 1205 | (defvar fancy-splash-help-echo nil) |
| 1206 | (defvar fancy-splash-stop-time nil) | 1206 | (defvar fancy-splash-stop-time nil) |
| 1207 | (defvar fancy-splash-outer-buffer nil) | 1207 | (defvar fancy-splash-outer-buffer nil) |
| 1208 | (defvar fancy-splash-last-input-event nil) | ||
| 1208 | 1209 | ||
| 1209 | (defun fancy-splash-insert (&rest args) | 1210 | (defun fancy-splash-insert (&rest args) |
| 1210 | "Insert text into the current buffer, with faces. | 1211 | "Insert text into the current buffer, with faces. |
| @@ -1359,6 +1360,14 @@ mouse." | |||
| 1359 | (push last-command-event unread-command-events)) | 1360 | (push last-command-event unread-command-events)) |
| 1360 | (throw 'exit nil)) | 1361 | (throw 'exit nil)) |
| 1361 | 1362 | ||
| 1363 | (defun fancy-splash-special-event-action () | ||
| 1364 | "Save the last event and stop displaying the splash screen buffer. | ||
| 1365 | This is an internal function used to turn off the splash screen after | ||
| 1366 | the user caused an input event that is bound in `special-event-map'" | ||
| 1367 | (interactive) | ||
| 1368 | (setq fancy-splash-last-input-event last-input-event) | ||
| 1369 | (throw 'exit nil)) | ||
| 1370 | |||
| 1362 | 1371 | ||
| 1363 | (defun fancy-splash-screens (&optional hide-on-input) | 1372 | (defun fancy-splash-screens (&optional hide-on-input) |
| 1364 | "Display fancy splash screens when Emacs starts." | 1373 | "Display fancy splash screens when Emacs starts." |
| @@ -1368,6 +1377,7 @@ mouse." | |||
| 1368 | splash-buffer | 1377 | splash-buffer |
| 1369 | (old-minor-mode-map-alist minor-mode-map-alist) | 1378 | (old-minor-mode-map-alist minor-mode-map-alist) |
| 1370 | (old-emulation-mode-map-alists emulation-mode-map-alists) | 1379 | (old-emulation-mode-map-alists emulation-mode-map-alists) |
| 1380 | (old-special-event-map special-event-map) | ||
| 1371 | (frame (fancy-splash-frame)) | 1381 | (frame (fancy-splash-frame)) |
| 1372 | timer) | 1382 | timer) |
| 1373 | (save-selected-window | 1383 | (save-selected-window |
| @@ -1383,6 +1393,20 @@ mouse." | |||
| 1383 | (define-key map [t] 'fancy-splash-default-action) | 1393 | (define-key map [t] 'fancy-splash-default-action) |
| 1384 | (define-key map [mouse-movement] 'ignore) | 1394 | (define-key map [mouse-movement] 'ignore) |
| 1385 | (define-key map [mode-line t] 'ignore) | 1395 | (define-key map [mode-line t] 'ignore) |
| 1396 | ;; Temporarily bind special events to | ||
| 1397 | ;; fancy-splash-special-event-action so as to stop | ||
| 1398 | ;; displaying splash screens with such events. | ||
| 1399 | ;; Otherwise, drag-n-drop into splash screens may | ||
| 1400 | ;; leave us in recursive editing with invisible | ||
| 1401 | ;; cursors for a while. | ||
| 1402 | (setq special-event-map (make-sparse-keymap)) | ||
| 1403 | (map-keymap | ||
| 1404 | (lambda (key def) | ||
| 1405 | (define-key special-event-map (vector key) | ||
| 1406 | (if (eq def 'ignore) | ||
| 1407 | 'ignore | ||
| 1408 | 'fancy-splash-special-event-action))) | ||
| 1409 | old-special-event-map) | ||
| 1386 | (setq display-hourglass nil | 1410 | (setq display-hourglass nil |
| 1387 | minor-mode-map-alist nil | 1411 | minor-mode-map-alist nil |
| 1388 | emulation-mode-map-alists nil | 1412 | emulation-mode-map-alists nil |
| @@ -1399,8 +1423,15 @@ mouse." | |||
| 1399 | (cancel-timer timer) | 1423 | (cancel-timer timer) |
| 1400 | (setq display-hourglass old-hourglass | 1424 | (setq display-hourglass old-hourglass |
| 1401 | minor-mode-map-alist old-minor-mode-map-alist | 1425 | minor-mode-map-alist old-minor-mode-map-alist |
| 1402 | emulation-mode-map-alists old-emulation-mode-map-alists) | 1426 | emulation-mode-map-alists old-emulation-mode-map-alists |
| 1403 | (kill-buffer splash-buffer))))) | 1427 | special-event-map old-special-event-map) |
| 1428 | (kill-buffer splash-buffer) | ||
| 1429 | (when fancy-splash-last-input-event | ||
| 1430 | (setq last-input-event fancy-splash-last-input-event | ||
| 1431 | fancy-splash-last-input-event nil) | ||
| 1432 | (command-execute (lookup-key special-event-map | ||
| 1433 | (vector last-input-event)) | ||
| 1434 | nil (vector last-input-event) t)))))) | ||
| 1404 | ;; If hide-on-input is nil, don't hide the buffer on input. | 1435 | ;; If hide-on-input is nil, don't hide the buffer on input. |
| 1405 | (if (or (window-minibuffer-p) | 1436 | (if (or (window-minibuffer-p) |
| 1406 | (window-dedicated-p (selected-window))) | 1437 | (window-dedicated-p (selected-window))) |