emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] /srv/bzr/emacs/trunk r100841: Revert 2010-07-14 change to


From: Chong Yidong
Subject: [Emacs-diffs] /srv/bzr/emacs/trunk r100841: Revert 2010-07-14 change to deactivate mark; minor cleanups.
Date: Sat, 17 Jul 2010 16:21:51 -0400
User-agent: Bazaar (2.0.3)

------------------------------------------------------------
revno: 100841
committer: Chong Yidong <address@hidden>
branch nick: trunk
timestamp: Sat 2010-07-17 16:21:51 -0400
message:
  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.
modified:
  lisp/ChangeLog
  lisp/mouse.el
  lisp/simple.el
=== modified file 'lisp/ChangeLog'
--- a/lisp/ChangeLog    2010-07-17 08:44:59 +0000
+++ b/lisp/ChangeLog    2010-07-17 20:21:51 +0000
@@ -1,3 +1,12 @@
+2010-07-17  Chong Yidong  <address@hidden>
+
+       * 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  <address@hidden>
 
        * net/tramp.el (tramp-get-ls-command-with-dired): Make test for

=== modified file 'lisp/mouse.el'
--- a/lisp/mouse.el     2010-07-17 02:49:48 +0000
+++ b/lisp/mouse.el     2010-07-17 20:21:51 +0000
@@ -1027,9 +1027,7 @@
              ;; For `select-active-regions' non-nil, ensure that
              ;; further alterations of the region (e.g. via
              ;; shift-selection) continue to update PRIMARY.
-             (and select-active-regions
-                  (display-selections-p)
-                  (x-set-selection 'PRIMARY (current-buffer))))
+             (select-active-region))
 
          ;; If point hasn't moved, run the binding of the
          ;; terminating up-event.

=== modified file 'lisp/simple.el'
--- a/lisp/simple.el    2010-07-17 02:49:48 +0000
+++ b/lisp/simple.el    2010-07-17 20:21:51 +0000
@@ -3687,7 +3687,6 @@
         mark-active
         (display-selections-p)
         (x-selection-owner-p 'PRIMARY)
-        (not (eq (region-beginning) (region-end)))
         (x-set-selection 'PRIMARY (buffer-substring-no-properties
                                    (region-beginning) (region-end))))
     (if (and (null force)
@@ -3708,9 +3707,13 @@
     (setq mark-active t)
     (unless transient-mark-mode
       (setq transient-mark-mode 'lambda))
-    (when (and select-active-regions
-              (display-selections-p))
-      (x-set-selection 'PRIMARY (current-buffer)))))
+    (select-active-region)))
+
+(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)
   "Set this buffer's mark to POS.  Don't use this function!
@@ -3733,9 +3736,7 @@
       (progn
        (setq mark-active t)
        (run-hooks 'activate-mark-hook)
-       (when (and select-active-regions
-                  (display-selections-p))
-         (x-set-selection 'PRIMARY (current-buffer)))
+       (select-active-region)
        (set-marker (mark-marker) pos (current-buffer)))
     ;; Normally we never clear mark-active except in Transient Mark mode.
     ;; But when we actually clear out the mark value too, we must
@@ -3819,8 +3820,7 @@
        (push-mark nil nomsg t)
       (setq mark-active t)
       (run-hooks 'activate-mark-hook)
-      (and select-active-regions (display-selections-p)
-          (x-set-selection 'PRIMARY (current-buffer)))
+      (select-active-region)
       (unless nomsg
        (message "Mark activated")))))
 
@@ -4008,9 +4008,12 @@
 deactivate it, and restore the variable `transient-mark-mode' to
 its earlier value."
   (cond ((and shift-select-mode this-command-keys-shift-translated)
-         (unless (and mark-active
-                      (eq (car-safe transient-mark-mode) 'only))
-           (setq transient-mark-mode
+         (if (and mark-active
+                 (eq (car-safe transient-mark-mode) 'only))
+            ;; Another program may have grabbed the selection; make
+            ;; sure we get it back now.
+            (select-active-region)
+          (setq transient-mark-mode
                  (cons 'only
                        (unless (eq transient-mark-mode 'lambda)
                          transient-mark-mode)))


reply via email to

[Prev in Thread] Current Thread [Next in Thread]