[PATCH] Fixes deactivate-mark issue when expanding selection to text-objects

Tim Harper timcharper at gmail.com
Fri Jul 23 08:37:37 CEST 2010


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




More information about the implementations-list mailing list