aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorDuncan Findlay2022-06-10 18:46:49 -0700
committerEli Zaretskii2022-06-18 14:10:19 +0300
commit2cb5ed66c094cc1ea937c72eb7958c2dc674ac7f (patch)
tree717684e72cfa65ac8261a49891fe9a1babe2fc07 /src
parente321f87aa76c959faed784851b65ab7ada3fd129 (diff)
downloademacs-2cb5ed66c094cc1ea937c72eb7958c2dc674ac7f.tar.gz
emacs-2cb5ed66c094cc1ea937c72eb7958c2dc674ac7f.zip
Support `select-active-regions' with xterm
This allows Emacs to save the active region to the user's primary selection on supported terminals. The behavior follows the existing `select-active-regions' variable and requires `xterm-select-active-regions' to be non-nil. * src/keyboard.c (command_loop_1): * lisp/frame.el (display-selections-p): On text terminals, check terminal parameter `xterm--set-selections' and variable `xterm-select-active-regions' when deciding whether to update primary selection. (bug#55883) * lisp/term/xterm.el (xterm-select-active-regions): New defcustom.
Diffstat (limited to 'src')
-rw-r--r--src/keyboard.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/keyboard.c b/src/keyboard.c
index 60ff8f5ea6a..cd92cf8d4ac 100644
--- a/src/keyboard.c
+++ b/src/keyboard.c
@@ -1567,9 +1567,15 @@ command_loop_1 (void)
1567 call0 (Qdeactivate_mark); 1567 call0 (Qdeactivate_mark);
1568 else 1568 else
1569 { 1569 {
1570 Lisp_Object symval;
1570 /* Even if not deactivating the mark, set PRIMARY if 1571 /* Even if not deactivating the mark, set PRIMARY if
1571 `select-active-regions' is non-nil. */ 1572 `select-active-regions' is non-nil. */
1572 if (!NILP (Fwindow_system (Qnil)) 1573 if ((!NILP (Fwindow_system (Qnil))
1574 || ((symval =
1575 find_symbol_value (Qxterm_select_active_regions),
1576 (!EQ (symval, Qunbound) && !NILP (symval)))
1577 && !NILP (Fterminal_parameter (Qnil,
1578 Qxterm__set_selection))))
1573 /* Even if mark_active is non-nil, the actual buffer 1579 /* Even if mark_active is non-nil, the actual buffer
1574 marker may not have been set yet (Bug#7044). */ 1580 marker may not have been set yet (Bug#7044). */
1575 && XMARKER (BVAR (current_buffer, mark))->buffer 1581 && XMARKER (BVAR (current_buffer, mark))->buffer
@@ -12163,6 +12169,8 @@ syms_of_keyboard (void)
12163 DEFSYM (Qpolling_period, "polling-period"); 12169 DEFSYM (Qpolling_period, "polling-period");
12164 12170
12165 DEFSYM (Qgui_set_selection, "gui-set-selection"); 12171 DEFSYM (Qgui_set_selection, "gui-set-selection");
12172 DEFSYM (Qxterm__set_selection, "xterm--set-selection");
12173 DEFSYM (Qxterm_select_active_regions, "xterm-select-active-regions");
12166 12174
12167 /* The primary selection. */ 12175 /* The primary selection. */
12168 DEFSYM (QPRIMARY, "PRIMARY"); 12176 DEFSYM (QPRIMARY, "PRIMARY");