1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2025-12-15 10:30:25 -08:00

* term/xterm.el (xterm--query): Stop after first matching handler. (Bug#14615)

This commit is contained in:
Glenn Morris 2013-06-14 14:37:38 -04:00
parent 4452891d08
commit 230dcbaf2f
2 changed files with 10 additions and 1 deletions

View file

@ -516,6 +516,9 @@ The relevant features are:
(terminal-init-xterm-modify-other-keys))))))
(defun xterm--query (query handlers)
"Send QUERY string to the terminal and watch for a response.
HANDLERS is an alist with elements of the form (STRING . FUNCTION).
We run the first FUNCTION whose STRING matches the input events."
;; We used to query synchronously, but the need to use `discard-input' is
;; rather annoying (bug#6758). Maybe we could always use the asynchronous
;; approach, but it's less tested.
@ -544,7 +547,8 @@ The relevant features are:
nil))))
(setq i (1+ i)))
(if (= i (length (car handler)))
(funcall (cdr handler))
(progn (setq handlers nil)
(funcall (cdr handler)))
(while (> i 0)
(push (aref (car handler) (setq i (1- i)))
unread-command-events)))))))