aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexander Gramiak2019-04-03 14:06:45 -0600
committerAlexander Gramiak2019-04-06 22:43:59 -0600
commitb68405405e5ee4ce7326e6ef32afbde48bafd7fe (patch)
treedc110034639bf592204ee1dab0700b5f825c22ce
parentcffc04c48dfed59ab9d958b9b64948d5fa491fbe (diff)
downloademacs-b68405405e5ee4ce7326e6ef32afbde48bafd7fe.tar.gz
emacs-b68405405e5ee4ce7326e6ef32afbde48bafd7fe.zip
Introduce new defcustom for terminal CUA rectangle commands
This allows a user to set a non-meta modifier for their terminal should his/her terminal support it. See bug#35058 for background on this change. * lisp/emulation/cua-base.el (cua-rectangle-terminal-modifier-key): New defcustom. * lisp/emulation/cua-base.el (cua--shift-control-x-prefix): Use new defcustom.
-rw-r--r--etc/NEWS7
-rw-r--r--lisp/emulation/cua-base.el19
2 files changed, 21 insertions, 5 deletions
diff --git a/etc/NEWS b/etc/NEWS
index be4543c0166..c7456c681a2 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -1252,6 +1252,13 @@ near the current column in Tabulated Lists (see variables
1252+++ 1252+++
1253*** 'text-mode-variant' is now obsolete, use 'derived-mode-p' instead. 1253*** 'text-mode-variant' is now obsolete, use 'derived-mode-p' instead.
1254 1254
1255** CUA mode
1256
1257---
1258*** New defcustom 'cua-rectangle-terminal-modifier-key'.
1259This defcustom allows for the customization of the modifier key used
1260in a terminal frame.
1261
1255 1262
1256* New Modes and Packages in Emacs 27.1 1263* New Modes and Packages in Emacs 27.1
1257 1264
diff --git a/lisp/emulation/cua-base.el b/lisp/emulation/cua-base.el
index 302ef123865..105e1ab43d8 100644
--- a/lisp/emulation/cua-base.el
+++ b/lisp/emulation/cua-base.el
@@ -427,7 +427,7 @@ and after the region marked by the rectangle to search."
427 427
428(defcustom cua-rectangle-modifier-key 'meta 428(defcustom cua-rectangle-modifier-key 'meta
429 "Modifier key used for rectangle commands bindings. 429 "Modifier key used for rectangle commands bindings.
430On non-window systems, always use the meta modifier. 430On non-window systems, use `cua-rectangle-terminal-modifier-key'.
431Must be set prior to enabling CUA." 431Must be set prior to enabling CUA."
432 :type '(choice (const :tag "Meta key" meta) 432 :type '(choice (const :tag "Meta key" meta)
433 (const :tag "Alt key" alt) 433 (const :tag "Alt key" alt)
@@ -435,6 +435,16 @@ Must be set prior to enabling CUA."
435 (const :tag "Super key" super)) 435 (const :tag "Super key" super))
436 :group 'cua) 436 :group 'cua)
437 437
438(defcustom cua-rectangle-terminal-modifier-key 'meta
439 "Modifier key used for rectangle commands bindings in terminals.
440Must be set prior to enabling CUA."
441 :type '(choice (const :tag "Meta key" meta)
442 (const :tag "Alt key" alt)
443 (const :tag "Hyper key" hyper)
444 (const :tag "Super key" super))
445 :group 'cua
446 :version "27.1")
447
438(defcustom cua-enable-rectangle-auto-help t 448(defcustom cua-enable-rectangle-auto-help t
439 "If non-nil, automatically show help for region, rectangle and global mark." 449 "If non-nil, automatically show help for region, rectangle and global mark."
440 :type 'boolean 450 :type 'boolean
@@ -1237,10 +1247,9 @@ If ARG is the atom `-', scroll upward by nearly full screen."
1237(defun cua--init-keymaps () 1247(defun cua--init-keymaps ()
1238 ;; Cache actual rectangle modifier key. 1248 ;; Cache actual rectangle modifier key.
1239 (setq cua--rectangle-modifier-key 1249 (setq cua--rectangle-modifier-key
1240 (if (and cua-rectangle-modifier-key 1250 (if (eq (framep (selected-frame)) t)
1241 (memq window-system '(x))) 1251 cua-rectangle-terminal-modifier-key
1242 cua-rectangle-modifier-key 1252 cua-rectangle-modifier-key))
1243 'meta))
1244 ;; C-return always toggles rectangle mark 1253 ;; C-return always toggles rectangle mark
1245 (define-key cua-global-keymap cua-rectangle-mark-key 'cua-set-rectangle-mark) 1254 (define-key cua-global-keymap cua-rectangle-mark-key 'cua-set-rectangle-mark)
1246 (unless (eq cua--rectangle-modifier-key 'meta) 1255 (unless (eq cua--rectangle-modifier-key 'meta)