]> git.eshelyaron.com Git - emacs.git/commitdiff
* lisp/mouse.el (mouse-yank-primary): Push the mark.
authorChong Yidong <cyd@gnu.org>
Sat, 29 Oct 2011 06:09:02 +0000 (14:09 +0800)
committerChong Yidong <cyd@gnu.org>
Sat, 29 Oct 2011 06:09:02 +0000 (14:09 +0800)
Fixes: debbugs:9894
lisp/ChangeLog
lisp/mouse.el

index 340ca33231f9b5337f310ecd95fda2f1b1fb75a5..7565548fe535cc612bc57493c1fc1a7a2ad59ae8 100644 (file)
@@ -1,5 +1,7 @@
 2011-10-29  Chong Yidong  <cyd@gnu.org>
 
+       * mouse.el (mouse-yank-primary): Push the mark (Bug#9894).
+
        * textmodes/flyspell.el (flyspell-word): Fix char offset for
        forged Ispell output (Bug#7904).
 
index 9b1cf48ccdc5466f916ac65b9698ff3190369283..615062dc031f9335aee7ee6519ab1cb32d0cbffa 100644 (file)
@@ -1133,8 +1133,8 @@ regardless of where you click."
 
 (defun mouse-yank-primary (click)
   "Insert the primary selection at the position clicked on.
-Move point to the end of the inserted text.
-If `mouse-yank-at-point' is non-nil, insert at point
+Move point to the end of the inserted text, and set mark at
+beginning.  If `mouse-yank-at-point' is non-nil, insert at point
 regardless of where you click."
   (interactive "e")
   ;; Give temporary modes such as isearch a chance to turn off.
@@ -1162,9 +1162,10 @@ regardless of where you click."
          ;; FIXME: What about xterm-mouse-mode etc.?
          (t
           (x-get-selection 'PRIMARY)))))
-    (if primary
-        (insert primary)
-      (error "No selection is available"))))
+    (unless primary
+      (error "No selection is available"))
+    (push-mark (point))
+    (insert primary)))
 
 (defun mouse-kill-ring-save (click)
   "Copy the region between point and the mouse click in the kill ring.