[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] trunk r115421: Make CUA-mode use shift-select-mode.
From: |
Stefan Monnier |
Subject: |
[Emacs-diffs] trunk r115421: Make CUA-mode use shift-select-mode. |
Date: |
Sun, 08 Dec 2013 08:11:55 +0000 |
User-agent: |
Bazaar (2.6b2) |
------------------------------------------------------------
revno: 115421
revision-id: address@hidden
parent: address@hidden
committer: Stefan Monnier <address@hidden>
branch nick: trunk
timestamp: Sun 2013-12-08 03:11:50 -0500
message:
Make CUA-mode use shift-select-mode.
* lisp/emulation/cua-base.el (cua--explicit-region-start)
(cua--last-region-shifted): Remove.
(cua--deactivate): Use deactivate-mark.
(cua--pre-command-handler-1): Don't handle shift-selection.
(cua--post-command-handler-1): Don't change transient-mark-mode.
(cua--select-keymaps): Use region-active-p rather than
cua--explicit-region-start or cua--last-region-shifted.
(cua-mode): Enable shift-select-mode.
* lisp/emulation/cua-rect.el (cua--rectangle-highlight-for-redisplay):
New function.
(redisplay-highlight-region-function): Use it.
modified:
lisp/ChangeLog changelog-20091113204419-o5vbwnq5f7feedwu-1432
lisp/emulation/cua-base.el cuabase.el-20091113204419-o5vbwnq5f7feedwu-2415
lisp/emulation/cua-rect.el cuarect.el-20091113204419-o5vbwnq5f7feedwu-2417
=== modified file 'lisp/ChangeLog'
--- a/lisp/ChangeLog 2013-12-08 07:32:01 +0000
+++ b/lisp/ChangeLog 2013-12-08 08:11:50 +0000
@@ -1,7 +1,22 @@
+2013-12-08 Stefan Monnier <address@hidden>
+
+ * emulation/cua-rect.el (cua--rectangle-highlight-for-redisplay):
+ New function.
+ (redisplay-highlight-region-function): Use it.
+
+ * emulation/cua-base.el (cua--explicit-region-start)
+ (cua--last-region-shifted): Remove.
+ (cua--deactivate): Use deactivate-mark.
+ (cua--pre-command-handler-1): Don't handle shift-selection.
+ (cua--post-command-handler-1): Don't change transient-mark-mode.
+ (cua--select-keymaps): Use region-active-p rather than
+ cua--explicit-region-start or cua--last-region-shifted.
+ (cua-mode): Enable shift-select-mode.
+
2013-12-08 Leo Liu <address@hidden>
- * progmodes/flymake.el (flymake-popup-current-error-menu): Rename
- from flymake-display-err-menu-for-current-line. Reimplement.
+ * progmodes/flymake.el (flymake-popup-current-error-menu):
+ Rename from flymake-display-err-menu-for-current-line. Reimplement.
(flymake-posn-at-point-as-event, flymake-popup-menu)
(flymake-make-emacs-menu): Remove. (Bug#16077)
=== modified file 'lisp/emulation/cua-base.el'
--- a/lisp/emulation/cua-base.el 2013-12-08 06:24:54 +0000
+++ b/lisp/emulation/cua-base.el 2013-12-08 08:11:50 +0000
@@ -625,13 +625,6 @@
;;; Aux. variables
-;; Current region was started using cua-set-mark.
-(defvar cua--explicit-region-start nil)
-(make-variable-buffer-local 'cua--explicit-region-start)
-
-;; Latest region was started using shifted movement command.
-(defvar cua--last-region-shifted nil)
-
;; buffer + point prior to current command when rectangle is active
;; checked in post-command hook to see if point was moved
(defvar cua--buffer-and-point-before-command nil)
@@ -762,11 +755,9 @@
deactivate-mark nil))
(defun cua--deactivate (&optional now)
- (setq cua--explicit-region-start nil)
(if (not now)
(setq deactivate-mark t)
- (setq mark-active nil)
- (run-hooks 'deactivate-mark-hook)))
+ (deactivate-mark)))
(defun cua--filter-buffer-noprops (start end)
(let ((str (filter-buffer-substring start end)))
@@ -862,7 +853,6 @@
"Cancel the active region, rectangle, or global mark."
(interactive)
(setq mark-active nil)
- (setq cua--explicit-region-start nil)
(if (fboundp 'cua--cancel-rectangle)
(cua--cancel-rectangle)))
@@ -1109,8 +1099,6 @@
(message "Mark cleared"))
(t
(push-mark-command nil nil)
- (setq cua--explicit-region-start t)
- (setq cua--last-region-shifted nil)
(if cua-enable-region-auto-help
(cua-help-for-region t)))))
@@ -1203,28 +1191,10 @@
((not (eq (get this-command 'CUA) 'move))
nil)
- ;; Handle shifted cursor keys and other movement commands.
- ;; If region is not active, region is activated if key is shifted.
- ;; If region is active, region is canceled if key is unshifted
- ;; (and region not started with C-SPC).
- ;; If rectangle is active, expand rectangle in specified direction and
- ;; ignore the movement.
- (this-command-keys-shift-translated
- (unless mark-active
- (push-mark-command nil t))
- (setq cua--last-region-shifted t)
- (setq cua--explicit-region-start nil))
-
;; Set mark if user explicitly said to do so
- ((or cua--explicit-region-start cua--rectangle)
+ (cua--rectangle ;FIXME: ??
(unless mark-active
- (push-mark-command nil nil)))
-
- ;; Else clear mark after this command.
- (t
- ;; If we set mark-active to nil here, the region highlight will not be
- ;; removed by the direct_output_ commands.
- (setq deactivate-mark t)))
+ (push-mark-command nil nil))))
;; Detect extension of rectangles by mouse or other movement
(setq cua--buffer-and-point-before-command
@@ -1244,22 +1214,13 @@
(when (fboundp 'cua--rectangle-post-command)
(cua--rectangle-post-command))
(setq cua--buffer-and-point-before-command nil)
- (if (or (not mark-active) deactivate-mark)
- (setq cua--explicit-region-start nil))
;; Debugging
(if cua--debug
(cond
(cua--rectangle (cua--rectangle-assert))
- (mark-active (message "Mark=%d Point=%d Expl=%s"
- (mark t) (point) cua--explicit-region-start))))
+ (mark-active (message "Mark=%d Point=%d" (mark t) (point)))))
- ;; Disable transient-mark-mode if rectangle active in current buffer.
- (if (not (window-minibuffer-p))
- (setq transient-mark-mode (and (not cua--rectangle)
- (if cua-highlight-region-shift-only
- (not cua--explicit-region-start)
- t))))
(if cua-enable-cursor-indications
(cua--update-indications))
@@ -1323,7 +1284,7 @@
cua-enable-cua-keys
(not cua-inhibit-cua-keys)
(or (eq cua-enable-cua-keys t)
- (not cua--explicit-region-start))
+ (region-active-p))
(not executing-kbd-macro)
(not cua--prefix-override-timer)))
(setq cua--ena-prefix-repeat-keymap
@@ -1334,7 +1295,7 @@
(and cua-enable-cua-keys
(not cua-inhibit-cua-keys)
(or (eq cua-enable-cua-keys t)
- cua--last-region-shifted)))
+ (region-active-p))))
(setq cua--ena-global-mark-keymap
(and cua--global-mark-active
(not (window-minibuffer-p)))))
@@ -1546,11 +1507,8 @@
(if (and (boundp 'pc-selection-mode) pc-selection-mode)
(pc-selection-mode -1))
(cua--deactivate)
- (setq shift-select-mode nil)
- (setq transient-mark-mode (and cua-mode
- (if cua-highlight-region-shift-only
- (not cua--explicit-region-start)
- t))))
+ (setq shift-select-mode t)
+ (transient-mark-mode (if cua-highlight-region-shift-only -1 1)))
(cua--saved-state
(setq transient-mark-mode (car cua--saved-state))
(if (nth 1 cua--saved-state)
=== modified file 'lisp/emulation/cua-rect.el'
--- a/lisp/emulation/cua-rect.el 2013-12-08 06:24:54 +0000
+++ b/lisp/emulation/cua-rect.el 2013-12-08 08:11:50 +0000
@@ -877,8 +877,7 @@
(push-mark nil nil t)))
(cua--activate-rectangle)
(cua--rectangle-set-corners)
- (setq mark-active t
- cua--explicit-region-start t)
+ (setq mark-active t)
(if cua-enable-rectangle-auto-help
(cua-help-for-rectangle t))))
@@ -886,8 +885,7 @@
"Cancel current rectangle."
(interactive)
(when cua--rectangle
- (setq mark-active nil
- cua--explicit-region-start nil)
+ (setq mark-active nil)
(cua--deactivate-rectangle)))
(defun cua-toggle-rectangle-mark ()
@@ -1378,6 +1376,14 @@
(add-function :around region-extract-function
#'cua--rectangle-region-extract)
+(add-function :around redisplay-highlight-region-function
+ #'cua--rectangle-highlight-for-redisplay)
+
+(defun cua--rectangle-highlight-for-redisplay (orig &rest args)
+ (if (not cua--rectangle) (apply orig args)
+ ;; When cua--rectangle is active, just don't highlight at all, since we
+ ;; already do it elsewhere.
+ ))
(defun cua--rectangle-region-extract (orig &optional delete)
(cond
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Emacs-diffs] trunk r115421: Make CUA-mode use shift-select-mode.,
Stefan Monnier <=