aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSean Whitton2026-01-10 12:46:01 +0000
committerSean Whitton2026-01-10 12:49:43 +0000
commitb07b3ae9f439c9fb18b09d5c33f160aca392a81d (patch)
tree887b9438b19e7a138e44a0c9a71d8a959a6a4ee7
parent4e779d20f1840fef380f5688ceb2cd80658bde0b (diff)
downloademacs-b07b3ae9f439c9fb18b09d5c33f160aca392a81d.tar.gz
emacs-b07b3ae9f439c9fb18b09d5c33f160aca392a81d.zip
; Fixes to last change.
-rw-r--r--doc/emacs/display.texi12
-rw-r--r--lisp/term/xterm.el42
2 files changed, 23 insertions, 31 deletions
diff --git a/doc/emacs/display.texi b/doc/emacs/display.texi
index d475fc3cfde..0cda594d5b1 100644
--- a/doc/emacs/display.texi
+++ b/doc/emacs/display.texi
@@ -2063,14 +2063,14 @@ dimension), @code{hollow} (a hollow box), @code{bar} (a vertical bar),
2063pixels tall), or @code{nil} (no cursor at all). 2063pixels tall), or @code{nil} (no cursor at all).
2064 2064
2065@vindex xterm-update-cursor 2065@vindex xterm-update-cursor
2066 On Xterm-compatible text terminals cursor customiztaion is controlled 2066 On Xterm-compatible text terminals cursor customization is controlled
2067by the user option @code{xterm-update-cursor}. Valid values are: 2067by the user option @code{xterm-update-cursor}. Valid values are
2068@code{t} to update the cursor's color and shape, @code{type} to update 2068@code{t} to update the cursor's color and shape, @code{type} to update
2069the cursor's shape only, @code{color} to update the cursor's color only, 2069the cursor's shape only, @code{color} to update the cursor's color only,
2070and @code{nil} to not update the cursor's appearance. Xterm-compatible 2070and @code{nil} to not update the cursor's appearance. Text terminals
2071text terminals can not display a hollow box and instead use a filled 2071can not display a hollow box and instead use a filled box. Similarly,
2072box. Similarly, Xterm-compatible text terminals ignore the pixel sizes 2072all text terminals ignore the pixel sizes for @code{bar} and
2073for @code{bar} and @code{hbar}. 2073@code{hbar}.
2074 2074
2075@findex hl-line-mode 2075@findex hl-line-mode
2076@findex global-hl-line-mode 2076@findex global-hl-line-mode
diff --git a/lisp/term/xterm.el b/lisp/term/xterm.el
index 47e82decb03..cc9d5101d52 100644
--- a/lisp/term/xterm.el
+++ b/lisp/term/xterm.el
@@ -81,7 +81,8 @@ capabilities, and only when that terminal understands bracketed paste."
81 :type 'boolean) 81 :type 'boolean)
82 82
83(defcustom xterm-update-cursor nil 83(defcustom xterm-update-cursor nil
84 "If non-nil, try to update the cursor's appearance on XTerm terminals. 84 "Whether to try to update cursor appearance on text terminals.
85This works only for Xterm-compatible text terminals.
85 86
86If set to t all supported attributes of the cursor are updated. 87If set to t all supported attributes of the cursor are updated.
87If set to `type' only the cursor type is updated. This uses the CSI 88If set to `type' only the cursor type is updated. This uses the CSI
@@ -1043,7 +1044,6 @@ We run the first FUNCTION whose STRING matches the input events."
1043 1044
1044(defun xterm--post-command-hook () 1045(defun xterm--post-command-hook ()
1045 "Hook for xterm features that need to be frequently updated." 1046 "Hook for xterm features that need to be frequently updated."
1046
1047 (unless (display-graphic-p) 1047 (unless (display-graphic-p)
1048 (when xterm-set-window-title 1048 (when xterm-set-window-title
1049 (xterm-set-window-title)) 1049 (xterm-set-window-title))
@@ -1329,25 +1329,22 @@ versions of xterm."
1329 1329
1330(defun xterm--init-update-cursor () 1330(defun xterm--init-update-cursor ()
1331 "Register hooks to run `xterm--update-cursor-type' appropriately." 1331 "Register hooks to run `xterm--update-cursor-type' appropriately."
1332
1333 (when (memq xterm-update-cursor '(color t)) 1332 (when (memq xterm-update-cursor '(color t))
1334 (xterm--query 1333 (xterm--query
1335 "\e]12;?\e\\" 1334 "\e]12;?\e\\"
1336 '(("\e]12;" . (lambda () 1335 `(("\e]12;" . ,(lambda ()
1337 (let ((str (xterm--read-string ?\e ?\\))) 1336 (let ((str (xterm--read-string ?\e ?\\)))
1338 ;; The response is specifically formated to set the 1337 ;; The response is specifically formated to set the
1339 ;; color 1338 ;; color
1340 (push 1339 (push
1341 (concat "\e]12;" str "\e\\") 1340 (concat "\e]12;" str "\e\\")
1342 (terminal-parameter nil 'tty-mode-reset-strings))))))) 1341 (terminal-parameter nil 'tty-mode-reset-strings)))))))
1343 ;; No need to set tty-mode-set-strings because 1342 ;; No need to set `tty-mode-set-strings' because
1344 ;; xterm--post-command-hook handles restoring the cursor color. 1343 ;; `xterm--post-command-hook' handles restoring the cursor color.
1345 1344
1346 (xterm--update-cursor-color)) 1345 (xterm--update-cursor-color))
1347
1348 (when (memq xterm-update-cursor '(type t)) 1346 (when (memq xterm-update-cursor '(type t))
1349 (xterm--update-cursor-type)) 1347 (xterm--update-cursor-type))
1350
1351 (add-hook 'post-command-hook 'xterm--post-command-hook)) 1348 (add-hook 'post-command-hook 'xterm--post-command-hook))
1352 1349
1353(defconst xterm--cursor-type-to-int 1350(defconst xterm--cursor-type-to-int
@@ -1357,13 +1354,11 @@ versions of xterm."
1357 bar 5 1354 bar 5
1358 hbar 3) 1355 hbar 3)
1359 "Mapping of cursor type symbols to control sequence integers. 1356 "Mapping of cursor type symbols to control sequence integers.
1360
1361Cursor type symbols are the same as for `cursor-type'.") 1357Cursor type symbols are the same as for `cursor-type'.")
1362 1358
1363(defun xterm--set-cursor-type (terminal type) 1359(defun xterm--set-cursor-type (terminal type)
1364 (let ((type-int (or (plist-get xterm--cursor-type-to-int type) 1)) 1360 (let ((type-int (or (plist-get xterm--cursor-type-to-int type) 1))
1365 (old (terminal-parameter terminal 'xterm--cursor-style))) 1361 (old (terminal-parameter terminal 'xterm--cursor-style)))
1366
1367 (when old 1362 (when old
1368 (set-terminal-parameter 1363 (set-terminal-parameter
1369 terminal 1364 terminal
@@ -1376,7 +1371,6 @@ Cursor type symbols are the same as for `cursor-type'.")
1376 (unless old 1371 (unless old
1377 ;; Assume that the default cursor is appropriate when exiting Emacs. 1372 ;; Assume that the default cursor is appropriate when exiting Emacs.
1378 (push "\e[0 q" (terminal-parameter terminal 'tty-mode-reset-strings))) 1373 (push "\e[0 q" (terminal-parameter terminal 'tty-mode-reset-strings)))
1379
1380 (set-terminal-parameter terminal 'xterm--cursor-type type-int))) 1374 (set-terminal-parameter terminal 'xterm--cursor-type type-int)))
1381 1375
1382(defun xterm--update-cursor-type () 1376(defun xterm--update-cursor-type ()
@@ -1390,14 +1384,12 @@ This updates the selected frame's terminal based on `cursor-type'."
1390 (when (consp buffer-cursor) (setf buffer-cursor (car buffer-cursor))) 1384 (when (consp buffer-cursor) (setf buffer-cursor (car buffer-cursor)))
1391 (when (consp window-cursor) (setf window-cursor (car window-cursor))) 1385 (when (consp window-cursor) (setf window-cursor (car window-cursor)))
1392 (when (consp frame-cursor) (setf frame-cursor (car frame-cursor))) 1386 (when (consp frame-cursor) (setf frame-cursor (car frame-cursor)))
1393 1387 (cond ((not (eq window-cursor t))
1394 (cond 1388 (setf type window-cursor))
1395 ((not (eq window-cursor t)) 1389 ((not (eq buffer-cursor t))
1396 (setf type window-cursor)) 1390 (setf type buffer-cursor))
1397 ((not (eq buffer-cursor t)) 1391 (t
1398 (setf type buffer-cursor)) 1392 (setf type frame-cursor)))
1399 (t
1400 (setf type frame-cursor)))
1401 (xterm--set-cursor-type nil type))) 1393 (xterm--set-cursor-type nil type)))
1402 1394
1403(defun xterm--update-cursor-color () 1395(defun xterm--update-cursor-color ()