1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2025-12-16 02:50:26 -08:00

Revert 2010-07-14 change to deactivate mark; minor cleanups.

* mouse.el (mouse-drag-track): Use select-active-region.

* simple.el (select-active-region): New function.
(push-mark-command, set-mark, activate-mark)
(handle-shift-selection): Use it.
(deactivate-mark): Don't check for size of region.
This commit is contained in:
Chong Yidong 2010-07-17 16:21:51 -04:00
parent 3b8eff3233
commit 91023c68af
3 changed files with 25 additions and 15 deletions

View file

@ -1,3 +1,12 @@
2010-07-17 Chong Yidong <cyd@stupidchicken.com>
* simple.el (select-active-region): New function.
(push-mark-command, set-mark, activate-mark)
(handle-shift-selection): Use it.
(deactivate-mark): Don't check for size of region.
* mouse.el (mouse-drag-track): Use select-active-region.
2010-07-17 Michael Albinus <michael.albinus@gmx.de> 2010-07-17 Michael Albinus <michael.albinus@gmx.de>
* net/tramp.el (tramp-get-ls-command-with-dired): Make test for * net/tramp.el (tramp-get-ls-command-with-dired): Make test for

View file

@ -1027,9 +1027,7 @@ DO-MOUSE-DRAG-REGION-POST-PROCESS should only be used by
;; For `select-active-regions' non-nil, ensure that ;; For `select-active-regions' non-nil, ensure that
;; further alterations of the region (e.g. via ;; further alterations of the region (e.g. via
;; shift-selection) continue to update PRIMARY. ;; shift-selection) continue to update PRIMARY.
(and select-active-regions (select-active-region))
(display-selections-p)
(x-set-selection 'PRIMARY (current-buffer))))
;; If point hasn't moved, run the binding of the ;; If point hasn't moved, run the binding of the
;; terminating up-event. ;; terminating up-event.

View file

@ -3687,7 +3687,6 @@ This function also runs `deactivate-mark-hook'."
mark-active mark-active
(display-selections-p) (display-selections-p)
(x-selection-owner-p 'PRIMARY) (x-selection-owner-p 'PRIMARY)
(not (eq (region-beginning) (region-end)))
(x-set-selection 'PRIMARY (buffer-substring-no-properties (x-set-selection 'PRIMARY (buffer-substring-no-properties
(region-beginning) (region-end)))) (region-beginning) (region-end))))
(if (and (null force) (if (and (null force)
@ -3708,9 +3707,13 @@ This function also runs `deactivate-mark-hook'."
(setq mark-active t) (setq mark-active t)
(unless transient-mark-mode (unless transient-mark-mode
(setq transient-mark-mode 'lambda)) (setq transient-mark-mode 'lambda))
(when (and select-active-regions (select-active-region)))
(display-selections-p))
(x-set-selection 'PRIMARY (current-buffer))))) (defsubst select-active-region ()
"Set the PRIMARY X selection if `select-active-regions' is non-nil."
(and select-active-regions
(display-selections-p)
(x-set-selection 'PRIMARY (current-buffer))))
(defun set-mark (pos) (defun set-mark (pos)
"Set this buffer's mark to POS. Don't use this function! "Set this buffer's mark to POS. Don't use this function!
@ -3733,9 +3736,7 @@ store it in a Lisp variable. Example:
(progn (progn
(setq mark-active t) (setq mark-active t)
(run-hooks 'activate-mark-hook) (run-hooks 'activate-mark-hook)
(when (and select-active-regions (select-active-region)
(display-selections-p))
(x-set-selection 'PRIMARY (current-buffer)))
(set-marker (mark-marker) pos (current-buffer))) (set-marker (mark-marker) pos (current-buffer)))
;; Normally we never clear mark-active except in Transient Mark mode. ;; Normally we never clear mark-active except in Transient Mark mode.
;; But when we actually clear out the mark value too, we must ;; But when we actually clear out the mark value too, we must
@ -3819,8 +3820,7 @@ Display `Mark set' unless the optional second arg NOMSG is non-nil."
(push-mark nil nomsg t) (push-mark nil nomsg t)
(setq mark-active t) (setq mark-active t)
(run-hooks 'activate-mark-hook) (run-hooks 'activate-mark-hook)
(and select-active-regions (display-selections-p) (select-active-region)
(x-set-selection 'PRIMARY (current-buffer)))
(unless nomsg (unless nomsg
(message "Mark activated"))))) (message "Mark activated")))))
@ -4008,9 +4008,12 @@ Otherwise, if the region has been activated temporarily,
deactivate it, and restore the variable `transient-mark-mode' to deactivate it, and restore the variable `transient-mark-mode' to
its earlier value." its earlier value."
(cond ((and shift-select-mode this-command-keys-shift-translated) (cond ((and shift-select-mode this-command-keys-shift-translated)
(unless (and mark-active (if (and mark-active
(eq (car-safe transient-mark-mode) 'only)) (eq (car-safe transient-mark-mode) 'only))
(setq transient-mark-mode ;; Another program may have grabbed the selection; make
;; sure we get it back now.
(select-active-region)
(setq transient-mark-mode
(cons 'only (cons 'only
(unless (eq transient-mark-mode 'lambda) (unless (eq transient-mark-mode 'lambda)
transient-mark-mode))) transient-mark-mode)))