diff options
| author | Chong Yidong | 2010-07-17 16:21:51 -0400 |
|---|---|---|
| committer | Chong Yidong | 2010-07-17 16:21:51 -0400 |
| commit | 91023c68af851d22bf72d22538276a7f23e1970c (patch) | |
| tree | 6b95e8432b1c3ea82ccdb4c18c78e4d4e9362c4b | |
| parent | 3b8eff32333e497a65c509ef31cfc925ee92c1ff (diff) | |
| download | emacs-91023c68af851d22bf72d22538276a7f23e1970c.tar.gz emacs-91023c68af851d22bf72d22538276a7f23e1970c.zip | |
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.
| -rw-r--r-- | lisp/ChangeLog | 9 | ||||
| -rw-r--r-- | lisp/mouse.el | 4 | ||||
| -rw-r--r-- | lisp/simple.el | 27 |
3 files changed, 25 insertions, 15 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 70e841f6c4f..7aca9ba3ef9 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,3 +1,12 @@ | |||
| 1 | 2010-07-17 Chong Yidong <cyd@stupidchicken.com> | ||
| 2 | |||
| 3 | * simple.el (select-active-region): New function. | ||
| 4 | (push-mark-command, set-mark, activate-mark) | ||
| 5 | (handle-shift-selection): Use it. | ||
| 6 | (deactivate-mark): Don't check for size of region. | ||
| 7 | |||
| 8 | * mouse.el (mouse-drag-track): Use select-active-region. | ||
| 9 | |||
| 1 | 2010-07-17 Michael Albinus <michael.albinus@gmx.de> | 10 | 2010-07-17 Michael Albinus <michael.albinus@gmx.de> |
| 2 | 11 | ||
| 3 | * net/tramp.el (tramp-get-ls-command-with-dired): Make test for | 12 | * net/tramp.el (tramp-get-ls-command-with-dired): Make test for |
diff --git a/lisp/mouse.el b/lisp/mouse.el index 39c6993d973..87cca4044b8 100644 --- a/lisp/mouse.el +++ b/lisp/mouse.el | |||
| @@ -1027,9 +1027,7 @@ DO-MOUSE-DRAG-REGION-POST-PROCESS should only be used by | |||
| 1027 | ;; For `select-active-regions' non-nil, ensure that | 1027 | ;; For `select-active-regions' non-nil, ensure that |
| 1028 | ;; further alterations of the region (e.g. via | 1028 | ;; further alterations of the region (e.g. via |
| 1029 | ;; shift-selection) continue to update PRIMARY. | 1029 | ;; shift-selection) continue to update PRIMARY. |
| 1030 | (and select-active-regions | 1030 | (select-active-region)) |
| 1031 | (display-selections-p) | ||
| 1032 | (x-set-selection 'PRIMARY (current-buffer)))) | ||
| 1033 | 1031 | ||
| 1034 | ;; If point hasn't moved, run the binding of the | 1032 | ;; If point hasn't moved, run the binding of the |
| 1035 | ;; terminating up-event. | 1033 | ;; terminating up-event. |
diff --git a/lisp/simple.el b/lisp/simple.el index 10b8ab67ebc..43cb31b226b 100644 --- a/lisp/simple.el +++ b/lisp/simple.el | |||
| @@ -3687,7 +3687,6 @@ This function also runs `deactivate-mark-hook'." | |||
| 3687 | mark-active | 3687 | mark-active |
| 3688 | (display-selections-p) | 3688 | (display-selections-p) |
| 3689 | (x-selection-owner-p 'PRIMARY) | 3689 | (x-selection-owner-p 'PRIMARY) |
| 3690 | (not (eq (region-beginning) (region-end))) | ||
| 3691 | (x-set-selection 'PRIMARY (buffer-substring-no-properties | 3690 | (x-set-selection 'PRIMARY (buffer-substring-no-properties |
| 3692 | (region-beginning) (region-end)))) | 3691 | (region-beginning) (region-end)))) |
| 3693 | (if (and (null force) | 3692 | (if (and (null force) |
| @@ -3708,9 +3707,13 @@ This function also runs `deactivate-mark-hook'." | |||
| 3708 | (setq mark-active t) | 3707 | (setq mark-active t) |
| 3709 | (unless transient-mark-mode | 3708 | (unless transient-mark-mode |
| 3710 | (setq transient-mark-mode 'lambda)) | 3709 | (setq transient-mark-mode 'lambda)) |
| 3711 | (when (and select-active-regions | 3710 | (select-active-region))) |
| 3712 | (display-selections-p)) | 3711 | |
| 3713 | (x-set-selection 'PRIMARY (current-buffer))))) | 3712 | (defsubst select-active-region () |
| 3713 | "Set the PRIMARY X selection if `select-active-regions' is non-nil." | ||
| 3714 | (and select-active-regions | ||
| 3715 | (display-selections-p) | ||
| 3716 | (x-set-selection 'PRIMARY (current-buffer)))) | ||
| 3714 | 3717 | ||
| 3715 | (defun set-mark (pos) | 3718 | (defun set-mark (pos) |
| 3716 | "Set this buffer's mark to POS. Don't use this function! | 3719 | "Set this buffer's mark to POS. Don't use this function! |
| @@ -3733,9 +3736,7 @@ store it in a Lisp variable. Example: | |||
| 3733 | (progn | 3736 | (progn |
| 3734 | (setq mark-active t) | 3737 | (setq mark-active t) |
| 3735 | (run-hooks 'activate-mark-hook) | 3738 | (run-hooks 'activate-mark-hook) |
| 3736 | (when (and select-active-regions | 3739 | (select-active-region) |
| 3737 | (display-selections-p)) | ||
| 3738 | (x-set-selection 'PRIMARY (current-buffer))) | ||
| 3739 | (set-marker (mark-marker) pos (current-buffer))) | 3740 | (set-marker (mark-marker) pos (current-buffer))) |
| 3740 | ;; Normally we never clear mark-active except in Transient Mark mode. | 3741 | ;; Normally we never clear mark-active except in Transient Mark mode. |
| 3741 | ;; But when we actually clear out the mark value too, we must | 3742 | ;; 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." | |||
| 3819 | (push-mark nil nomsg t) | 3820 | (push-mark nil nomsg t) |
| 3820 | (setq mark-active t) | 3821 | (setq mark-active t) |
| 3821 | (run-hooks 'activate-mark-hook) | 3822 | (run-hooks 'activate-mark-hook) |
| 3822 | (and select-active-regions (display-selections-p) | 3823 | (select-active-region) |
| 3823 | (x-set-selection 'PRIMARY (current-buffer))) | ||
| 3824 | (unless nomsg | 3824 | (unless nomsg |
| 3825 | (message "Mark activated"))))) | 3825 | (message "Mark activated"))))) |
| 3826 | 3826 | ||
| @@ -4008,9 +4008,12 @@ Otherwise, if the region has been activated temporarily, | |||
| 4008 | deactivate it, and restore the variable `transient-mark-mode' to | 4008 | deactivate it, and restore the variable `transient-mark-mode' to |
| 4009 | its earlier value." | 4009 | its earlier value." |
| 4010 | (cond ((and shift-select-mode this-command-keys-shift-translated) | 4010 | (cond ((and shift-select-mode this-command-keys-shift-translated) |
| 4011 | (unless (and mark-active | 4011 | (if (and mark-active |
| 4012 | (eq (car-safe transient-mark-mode) 'only)) | 4012 | (eq (car-safe transient-mark-mode) 'only)) |
| 4013 | (setq transient-mark-mode | 4013 | ;; Another program may have grabbed the selection; make |
| 4014 | ;; sure we get it back now. | ||
| 4015 | (select-active-region) | ||
| 4016 | (setq transient-mark-mode | ||
| 4014 | (cons 'only | 4017 | (cons 'only |
| 4015 | (unless (eq transient-mark-mode 'lambda) | 4018 | (unless (eq transient-mark-mode 'lambda) |
| 4016 | transient-mark-mode))) | 4019 | transient-mark-mode))) |