emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] /srv/bzr/emacs/trunk r100787: * mouse.el (mouse-drag-track


From: Chong Yidong
Subject: [Emacs-diffs] /srv/bzr/emacs/trunk r100787: * mouse.el (mouse-drag-track): Handle select-active-regions (Bug#6612).
Date: Sun, 11 Jul 2010 18:14:53 -0400
User-agent: Bazaar (2.0.3)

------------------------------------------------------------
revno: 100787
committer: Chong Yidong <address@hidden>
branch nick: trunk
timestamp: Sun 2010-07-11 18:14:53 -0400
message:
  * mouse.el (mouse-drag-track): Handle select-active-regions (Bug#6612).
modified:
  lisp/ChangeLog
  lisp/mouse.el
=== modified file 'lisp/ChangeLog'
--- a/lisp/ChangeLog    2010-07-11 08:28:04 +0000
+++ b/lisp/ChangeLog    2010-07-11 22:14:53 +0000
@@ -1,3 +1,8 @@
+2010-07-11  Chong Yidong  <address@hidden>
+
+       * mouse.el (mouse-drag-track): Handle select-active-regions
+       (Bug#6612).
+
 2010-07-11  Magnus Henoch  <address@hidden>
 
        * net/tramp-gvfs.el (tramp-gvfs-handle-copy-file): Do not pass

=== modified file 'lisp/mouse.el'
--- a/lisp/mouse.el     2010-07-10 18:52:53 +0000
+++ b/lisp/mouse.el     2010-07-11 22:14:53 +0000
@@ -956,9 +956,12 @@
          (if (eq transient-mark-mode 'lambda)
              '(only)
            (cons 'only transient-mark-mode)))
-    (let ((range (mouse-start-end start-point start-point click-count)))
+    (let ((range (mouse-start-end start-point start-point click-count))
+         ;; Prevent `push-mark' from clobbering the primary selection
+         ;; if the user clicks without dragging.
+         (select-active-regions nil))
       (goto-char (nth 0 range))
-      (push-mark nil nil t)
+      (push-mark nil t t)
       (goto-char (nth 1 range)))
 
     ;; Track the mouse until we get a non-movement event.
@@ -1012,6 +1015,7 @@
                                                   mouse-set-region))))))
        (if (and (/= (mark) (point))
                 (not do-multi-click))
+
            ;; If point has moved, finish the drag.
            (let* (last-command this-command)
              ;; Copy the region so that `select-active-regions' can
@@ -1019,12 +1023,20 @@
              (and mouse-drag-copy-region
                   do-mouse-drag-region-post-process
                   (let (deactivate-mark)
-                    (copy-region-as-kill (mark) (point)))))
+                    (copy-region-as-kill (mark) (point))))
+             ;; 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))))
+
          ;; If point hasn't moved, run the binding of the
          ;; terminating up-event.
          (if do-multi-click
              (goto-char start-point)
-           (deactivate-mark))
+           (let (select-active-regions)
+             (deactivate-mark)))
          (when (and (functionp fun)
                     (= start-hscroll (window-hscroll start-window))
                     ;; Don't run the up-event handler if the window


reply via email to

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