Function: xterm--set-cursor-type

xterm--set-cursor-type is a byte-compiled function defined in xterm.el.gz.

Signature

(xterm--set-cursor-type TERMINAL TYPE)

Source Code

;; Defined in /usr/src/emacs/lisp/term/xterm.el.gz
(defun xterm--set-cursor-type (terminal type)
  (let ((type-int (or (plist-get xterm--cursor-type-to-int type) 1))
        (old (terminal-parameter terminal 'xterm--cursor-style)))
    (when old
      (set-terminal-parameter
       terminal
       'tty-mode-set-strings
       (delete (format "\e[%d q" old)
               (terminal-parameter terminal 'tty-mode-set-strings))))
    (let ((set-string (format "\e[%d q" type-int)))
      (push set-string (terminal-parameter terminal 'tty-mode-set-strings))
      (send-string-to-terminal set-string terminal))
    (unless old
      ;; Assume that the default cursor is appropriate when exiting Emacs.
      (push "\e[0 q" (terminal-parameter terminal 'tty-mode-reset-strings)))
    (set-terminal-parameter terminal 'xterm--cursor-type type-int)))