[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] master b684054 4/5: Introduce new defcustom for terminal C
From: |
Alexander Gramiak |
Subject: |
[Emacs-diffs] master b684054 4/5: Introduce new defcustom for terminal CUA rectangle commands |
Date: |
Sun, 7 Apr 2019 00:44:30 -0400 (EDT) |
branch: master
commit b68405405e5ee4ce7326e6ef32afbde48bafd7fe
Author: Alexander Gramiak <address@hidden>
Commit: Alexander Gramiak <address@hidden>
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.
---
etc/NEWS | 7 +++++++
lisp/emulation/cua-base.el | 19 ++++++++++++++-----
2 files changed, 21 insertions(+), 5 deletions(-)
diff --git a/etc/NEWS b/etc/NEWS
index be4543c..c7456c6 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -1252,6 +1252,13 @@ near the current column in Tabulated Lists (see variables
+++
*** 'text-mode-variant' is now obsolete, use 'derived-mode-p' instead.
+** CUA mode
+
+---
+*** New defcustom 'cua-rectangle-terminal-modifier-key'.
+This defcustom allows for the customization of the modifier key used
+in a terminal frame.
+
* New Modes and Packages in Emacs 27.1
diff --git a/lisp/emulation/cua-base.el b/lisp/emulation/cua-base.el
index 302ef12..105e1ab 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."
(defcustom cua-rectangle-modifier-key 'meta
"Modifier key used for rectangle commands bindings.
-On non-window systems, always use the meta modifier.
+On non-window systems, use `cua-rectangle-terminal-modifier-key'.
Must be set prior to enabling CUA."
:type '(choice (const :tag "Meta key" meta)
(const :tag "Alt key" alt)
@@ -435,6 +435,16 @@ Must be set prior to enabling CUA."
(const :tag "Super key" super))
:group 'cua)
+(defcustom cua-rectangle-terminal-modifier-key 'meta
+ "Modifier key used for rectangle commands bindings in terminals.
+Must be set prior to enabling CUA."
+ :type '(choice (const :tag "Meta key" meta)
+ (const :tag "Alt key" alt)
+ (const :tag "Hyper key" hyper)
+ (const :tag "Super key" super))
+ :group 'cua
+ :version "27.1")
+
(defcustom cua-enable-rectangle-auto-help t
"If non-nil, automatically show help for region, rectangle and global mark."
:type 'boolean
@@ -1237,10 +1247,9 @@ If ARG is the atom `-', scroll upward by nearly full
screen."
(defun cua--init-keymaps ()
;; Cache actual rectangle modifier key.
(setq cua--rectangle-modifier-key
- (if (and cua-rectangle-modifier-key
- (memq window-system '(x)))
- cua-rectangle-modifier-key
- 'meta))
+ (if (eq (framep (selected-frame)) t)
+ cua-rectangle-terminal-modifier-key
+ cua-rectangle-modifier-key))
;; C-return always toggles rectangle mark
(define-key cua-global-keymap cua-rectangle-mark-key 'cua-set-rectangle-mark)
(unless (eq cua--rectangle-modifier-key 'meta)