Function: kkp--query-terminal-sync
kkp--query-terminal-sync is a natively compiled function defined in
kkp.el.
Signature
(kkp--query-terminal-sync QUERY &optional TERMINATOR)
Documentation
Send QUERY to the current terminal and return its response (if any).
Read events until TERMINATOR (a character) is received, then stop. When TERMINATOR is nil, or the terminal never sends it, keep reading until the timeout elapses with no more input.
Source Code
;; Defined in /nix/store/0igl9q4k4n87vg4h2gnnrlha21kx9biv-emacs-packages-deps/share/emacs/site-lisp/elpa/kkp-20260706.858/kkp.el
(defun kkp--query-terminal-sync (query &optional terminator)
"Send QUERY to the current terminal and return its response (if any).
Read events until TERMINATOR (a character) is received, then stop.
When TERMINATOR is nil, or the terminal
never sends it, keep reading until the timeout elapses with no more input."
(kkp--verbose "query (sync): sending CSI %S (timeout %s s)" query (or kkp-terminal-query-timeout "none"))
(discard-input)
(send-string-to-terminal (kkp--csi-escape query))
(kkp--flush-standard-output)
(let ((loop-cond t)
(terminal-input nil))
(while loop-cond
(let ((evt (read-event nil nil kkp-terminal-query-timeout)))
(cond
((null evt) (setq loop-cond nil))
(t (push evt terminal-input)
(when (eql evt terminator)
(setq loop-cond nil))))))
(let ((reply (nreverse terminal-input)))
(kkp--verbose "query (sync): got %s bytes%s" (length reply)
(if (null reply)
" (no reply; slow SSH or non-KKP?)"
(concat " " (kkp--format-bytes-and-readable reply))))
reply)))