[PATCH] Fixes deactivate-mark issue when expanding selection to text-objects
When CUA mode is active, commands such as viw, viW, vis, etc. would exit visual mode because cua-mode, on activation, sets deactivate-mark to t, and deactivate-mark isn't protected by save-excursion. This change prevents that, and therefore fixes this issue. --- vimpulse-visual-mode.el | 7 ++++--- 1 files changed, 4 insertions(+), 3 deletions(-) diff --git a/vimpulse-visual-mode.el b/vimpulse-visual-mode.el index a9c0240..2430d0a 100644 --- a/vimpulse-visual-mode.el +++ b/vimpulse-visual-mode.el @@ -281,9 +281,10 @@ Saves the previous state of Transient Mark mode in (transient-mark-mode 1) (transient-mark-mode -1))) (when (boundp 'cua-mode) - (if (vimpulse-visual-before cua-mode) - (cua-mode 1) - (cua-mode -1))) + (let (deactivate-mark) ;; prevent cua-mode from setting deactivate-mark to t + (if (vimpulse-visual-before cua-mode) + (cua-mode 1) + (cua-mode -1)))) (when (boundp 'zmacs-regions) (let ((oldval (vimpulse-visual-before zmacs-regions))) (setq zmacs-regions oldval))))) -- 1.7.1.1
On Fri, Jul 23, 2010 at 12:37 AM, Tim Harper <[email protected]> wrote:
When CUA mode is active, commands such as viw, viW, vis, etc. would exit visual mode because cua-mode, on activation, sets deactivate-mark to t, and deactivate-mark isn't protected by save-excursion. This change prevents that, and therefore fixes this issue.
Come to think about it... I'm not even sure why I'm using CUA mode now, since the vimpulse rectangular selection is PARTY-HATS-FLYING-EVERYONE-DOING-CARTWHEELS-IN-THE-AIR-WORLDS-BETTER than CUA's rectangle selection mode. Still... this should be fixed.
On 2010-07-23 08:41, Tim Harper wrote:
When CUA mode is active, commands such as viw, viW, vis, etc. would exit visual mode because cua-mode, on activation, sets deactivate-mark to t, and deactivate-mark isn't protected by save-excursion. This change prevents that, and therefore fixes this issue.
Come to think about it... I'm not even sure why I'm using CUA mode now, since the vimpulse rectangular selection is PARTY-HATS-FLYING-EVERYONE-DOING-CARTWHEELS-IN-THE-AIR-WORLDS-BETTER than CUA's rectangle selection mode.
Thanks! The patch was applied in commit [9b9c029853]. -- Vegard
participants (2)
-
Tim Harper -
Vegard Øye