1
0
mirror of https://git.savannah.gnu.org/git/emacs.git synced 2024-12-23 10:34:07 +00:00

(momentary-string-display): Support EXIT-CHAR that is

either a character representation of an event or an event
description list.
This commit is contained in:
Eli Zaretskii 2004-04-27 13:07:16 +00:00
parent a4391d4225
commit 12092fb374
2 changed files with 28 additions and 6 deletions

View File

@ -1,3 +1,9 @@
2004-04-27 Matthew Mundell <matt@mundell.ukfsn.org>
* subr.el (momentary-string-display): Support EXIT-CHAR that is
either a character representation of an event or an event
description list.
2004-04-27 Daniel M Coffman <coffmand@us.ibm.com> (tiny change)
* arc-mode.el (archive-maybe-copy): If ARCHIVE includes leading

View File

@ -1457,9 +1457,11 @@ menu bar menus and the frame title."
(defun momentary-string-display (string pos &optional exit-char message)
"Momentarily display STRING in the buffer at POS.
Display remains until next character is typed.
If the char is EXIT-CHAR (optional third arg, default is SPC) it is swallowed;
otherwise it is then available as input (as a command if nothing else).
Display remains until next event is input.
Optional third arg EXIT-CHAR can be a character, event or event
description list. EXIT-CHAR defaults to SPC. If the input is
EXIT-CHAR it is swallowed; otherwise it is then available as
input (as a command if nothing else).
Display MESSAGE (optional fourth arg) in the echo area.
If MESSAGE is nil, instructions to type EXIT-CHAR are displayed there."
(or exit-char (setq exit-char ?\ ))
@ -1489,9 +1491,23 @@ If MESSAGE is nil, instructions to type EXIT-CHAR are displayed there."
(recenter 0))))
(message (or message "Type %s to continue editing.")
(single-key-description exit-char))
(let ((char (read-event)))
(or (eq char exit-char)
(setq unread-command-events (list char)))))
(let (char)
(if (integerp exit-char)
(condition-case nil
(progn
(setq char (read-char))
(or (eq char exit-char)
(setq unread-command-events (list char))))
(error
;; `exit-char' is a character, hence it differs
;; from char, which is an event.
(setq unread-command-events (list char))))
;; `exit-char' can be an event, or an event description
;; list.
(setq char (read-event))
(or (eq char exit-char)
(eq char (event-convert-list exit-char))
(setq unread-command-events (list char))))))
(if insert-end
(save-excursion
(delete-region pos insert-end)))