phimuemue
phimuemue

Reputation: 35983

Emacs: Disable shift-selection in CUA-mode

I managed to disable the built-in shift-selection via (set-variable 'shift-select-mode nil). And I like the C-Ret-column-selection of CUA-mode. But CUA automatically enables shift-selection (but seemingly not via the variable shift-select-mode).

Upvotes: 3

Views: 1646

Answers (3)

Jonathan Leech-Pepin
Jonathan Leech-Pepin

Reputation: 7884

To only enable rectangle (column) editing from Cua you can use the following (from emacs-fu)

(setq cua-enable-cua-keys nil) ;; only for rectangles (cua-mode t)

Upvotes: 0

mattc
mattc

Reputation: 495

Specifically, to disable the shift-selection for cua-mode, add the following to your init file (e.g. .emacs) prior to turning on cua-mode:

(setq cua-enable-cua-keys nil)
(setq cua-highlight-region-shift-only t) ;; no transient mark mode
(setq cua-toggle-set-mark nil) ;; original set-mark behavior, i.e. no transient-mark-mode

...
(cua-mode)

Originally answered https://superuser.com/a/77453/223457

Upvotes: 0

phils
phils

Reputation: 73274

This isn't a solution, but FYI...

I noticed this variable mentioned in the help for cua-mode

cua-highlight-region-shift-only is a variable defined in `cua-base.el'.

*If non-nil, only highlight region if marked with S-<move>.
When this is non-nil, CUA toggles `transient-mark-mode' on when the region
is marked using shifted movement keys, and off when the mark is cleared.
But when the mark was set using M-x cua-set-mark, Transient Mark mode
is not turned on.

cua-mode does this:

(setq shift-select-mode nil)
(setq transient-mark-mode (and cua-mode
               (if cua-highlight-region-shift-only
                   (not cua--explicit-region-start)
                 t))))

Upvotes: 0

Related Questions