summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChong Yidong <cyd@gnu.org>2011-10-29 14:09:02 +0800
committerChong Yidong <cyd@gnu.org>2011-10-29 14:09:02 +0800
commite1eb5385bb8c30e9a9ff3b04b0928664e3440e01 (patch)
tree96151552fe2dd34ae2d6852a48f8c80e792ff980
parent5d2ece3cd22aed2a89f51c315564605d52ebf382 (diff)
downloademacs-e1eb5385bb8c30e9a9ff3b04b0928664e3440e01.tar.gz
* lisp/mouse.el (mouse-yank-primary): Push the mark.
Fixes: debbugs:9894
-rw-r--r--lisp/ChangeLog2
-rw-r--r--lisp/mouse.el11
2 files changed, 8 insertions, 5 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 340ca33231f..7565548fe53 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -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).
diff --git a/lisp/mouse.el b/lisp/mouse.el
index 9b1cf48ccdc..615062dc031 100644
--- a/lisp/mouse.el
+++ b/lisp/mouse.el
@@ -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.