emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] emacs/lisp ChangeLog mouse.el simple.el w32-fns.el


From: Chong Yidong
Subject: [Emacs-diffs] emacs/lisp ChangeLog mouse.el simple.el w32-fns.el
Date: Fri, 17 Jul 2009 15:45:16 +0000

CVSROOT:        /sources/emacs
Module name:    emacs
Changes by:     Chong Yidong <cyd>      09/07/17 15:45:15

Modified files:
        lisp           : ChangeLog mouse.el simple.el w32-fns.el 

Log message:
        * w32-fns.el (x-selection-owner-p): New function.
        
        * mouse.el (mouse-drag-track): Call deactivate-mark earlier.
        (mouse-yank-at-click): If select-active-regions is non-nil,
        deactivate the mark before insertion.
        
        * simple.el (deactivate-mark, set-mark): Only save selection if we
        own it.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/emacs/lisp/ChangeLog?cvsroot=emacs&r1=1.15818&r2=1.15819
http://cvs.savannah.gnu.org/viewcvs/emacs/lisp/mouse.el?cvsroot=emacs&r1=1.354&r2=1.355
http://cvs.savannah.gnu.org/viewcvs/emacs/lisp/simple.el?cvsroot=emacs&r1=1.993&r2=1.994
http://cvs.savannah.gnu.org/viewcvs/emacs/lisp/w32-fns.el?cvsroot=emacs&r1=1.91&r2=1.92

Patches:
Index: ChangeLog
===================================================================
RCS file: /sources/emacs/emacs/lisp/ChangeLog,v
retrieving revision 1.15818
retrieving revision 1.15819
diff -u -b -r1.15818 -r1.15819
--- ChangeLog   17 Jul 2009 12:26:55 -0000      1.15818
+++ ChangeLog   17 Jul 2009 15:45:08 -0000      1.15819
@@ -1,3 +1,14 @@
+2009-07-17  David De La Harpe Golden  <address@hidden>
+
+       * w32-fns.el (x-selection-owner-p): New function.
+
+       * mouse.el (mouse-drag-track): Call deactivate-mark earlier.
+       (mouse-yank-at-click): If select-active-regions is non-nil,
+       deactivate the mark before insertion.
+
+       * simple.el (deactivate-mark, set-mark): Only save selection if we
+       own it.
+
 2009-07-17  Kenichi Handa  <address@hidden>
 
        * case-table.el (describe-buffer-case-table): Fix for the case

Index: mouse.el
===================================================================
RCS file: /sources/emacs/emacs/lisp/mouse.el,v
retrieving revision 1.354
retrieving revision 1.355
diff -u -b -r1.354 -r1.355
--- mouse.el    15 Jul 2009 01:25:36 -0000      1.354
+++ mouse.el    17 Jul 2009 15:45:14 -0000      1.355
@@ -927,6 +927,11 @@
 should only be used by mouse-drag-region."
   (mouse-minibuffer-check start-event)
   (setq mouse-selection-click-count-buffer (current-buffer))
+  ;; We must call deactivate-mark before repositioning point.
+  ;; Otherwise, for select-active-regions non-nil, we get the wrong
+  ;; selection if the user drags a region, clicks elsewhere to
+  ;; reposition point, then middle-clicks to paste the selection.
+  (deactivate-mark)
   (let* ((original-window (selected-window))
          ;; We've recorded what we needed from the current buffer and
          ;; window, now let's jump to the place of the event, where things
@@ -971,7 +976,6 @@
     (mouse-move-drag-overlay mouse-drag-overlay start-point start-point
                              click-count)
     (overlay-put mouse-drag-overlay 'window start-window)
-    (deactivate-mark)
     (let (event end end-point last-end-point)
       (track-mouse
        (while (progn
@@ -1360,10 +1364,16 @@
 and set mark at the beginning.
 Prefix arguments are interpreted as with \\[yank].
 If `mouse-yank-at-point' is non-nil, insert at point
-regardless of where you click."
+regardless of where you click.
+If `select-active-regions' is non-nil, the mark is deactivated
+before inserting the text."
   (interactive "e\nP")
   ;; Give temporary modes such as isearch a chance to turn off.
   (run-hooks 'mouse-leave-buffer-hook)
+  (when select-active-regions
+    ;; Without this, confusing things happen upon e.g. inserting into
+    ;; the middle of an active region.
+    (deactivate-mark t))
   (or mouse-yank-at-point (mouse-set-point click))
   (setq this-command 'yank)
   (setq mouse-selection-click-count 0)

Index: simple.el
===================================================================
RCS file: /sources/emacs/emacs/lisp/simple.el,v
retrieving revision 1.993
retrieving revision 1.994
diff -u -b -r1.993 -r1.994
--- simple.el   15 Jul 2009 02:05:35 -0000      1.993
+++ simple.el   17 Jul 2009 15:45:14 -0000      1.994
@@ -3489,6 +3489,7 @@
     ;; Copy the latest region into the primary selection, if desired.
     (and select-active-regions
         mark-active
+        (x-selection-owner-p 'PRIMARY)
         (x-set-selection 'PRIMARY (buffer-substring-no-properties
                                    (region-beginning) (region-end))))
     (if (and (null force)
@@ -3533,7 +3534,11 @@
       (progn
        (setq mark-active t)
        (run-hooks 'activate-mark-hook)
-       (when select-active-regions
+       (and select-active-regions
+            ;; Only set the selection if we already own PRIMARY.  The
+            ;; initial selection grab happens in `activate-mark', but
+            ;; it is necessary to update it here.
+            (x-selection-owner-p 'PRIMARY)
          (x-set-selection 'PRIMARY (current-buffer)))
        (set-marker (mark-marker) pos (current-buffer)))
     ;; Normally we never clear mark-active except in Transient Mark mode.

Index: w32-fns.el
===================================================================
RCS file: /sources/emacs/emacs/lisp/w32-fns.el,v
retrieving revision 1.91
retrieving revision 1.92
diff -u -b -r1.91 -r1.92
--- w32-fns.el  5 Jan 2009 03:19:55 -0000       1.91
+++ w32-fns.el  17 Jul 2009 15:45:15 -0000      1.92
@@ -294,12 +294,15 @@
 
 ;;; Fix interface to (X-specific) mouse.el
 (defun x-set-selection (type data)
-  (or type (setq type 'PRIMARY))
-  (put 'x-selections type data))
+  (put 'x-selections (or type 'PRIMARY) data))
 
 (defun x-get-selection (&optional type data-type)
-  (or type (setq type 'PRIMARY))
-  (get 'x-selections type))
+  (get 'x-selections (or type 'PRIMARY)))
+
+;; x-selection-owner-p is used in simple.el
+(defun x-selection-owner-p (&optional type)
+  (and (memq type '(nil PRIMARY SECONDARY))
+       (get 'x-selections (or type 'PRIMARY))))
 
 (defun set-w32-system-coding-system (coding-system)
   "Set the coding system used by the Windows system to CODING-SYSTEM.




reply via email to

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