aboutsummaryrefslogtreecommitdiffstats
path: root/lisp
diff options
context:
space:
mode:
authorChong Yidong2011-08-21 13:56:19 -0400
committerChong Yidong2011-08-21 13:56:19 -0400
commitff98b2dd51e84b812e061859fa8c682d22b2e459 (patch)
tree5d02aff0715264d93085f7f84f679ed8749864a4 /lisp
parent23a8a5ab697f3389ea6478cdfefe4e67fff28051 (diff)
downloademacs-ff98b2dd51e84b812e061859fa8c682d22b2e459.tar.gz
emacs-ff98b2dd51e84b812e061859fa8c682d22b2e459.zip
* lisp/term.el (term-mouse-paste): Yank primary selection (Bug#6845).
Diffstat (limited to 'lisp')
-rw-r--r--lisp/ChangeLog2
-rw-r--r--lisp/term.el21
2 files changed, 16 insertions, 7 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 6de159536a1..e110b962637 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,5 +1,7 @@
12011-08-21 Chong Yidong <cyd@stupidchicken.com> 12011-08-21 Chong Yidong <cyd@stupidchicken.com>
2 2
3 * term.el (term-mouse-paste): Yank primary selection (Bug#6845).
4
3 * emacs-lisp/find-func.el (find-function-noselect): New arg 5 * emacs-lisp/find-func.el (find-function-noselect): New arg
4 lisp-only. 6 lisp-only.
5 7
diff --git a/lisp/term.el b/lisp/term.el
index 6d7f6f5c535..361ff685396 100644
--- a/lisp/term.el
+++ b/lisp/term.el
@@ -1227,9 +1227,9 @@ without any interpretation."
1227 (make-string 1 char) 1227 (make-string 1 char)
1228 (format "\e%c" char))))) 1228 (format "\e%c" char)))))
1229 1229
1230(defun term-mouse-paste (click arg) 1230(defun term-mouse-paste (click)
1231 "Insert the last stretch of killed text at the position clicked on." 1231 "Insert the primary selection at the position clicked on."
1232 (interactive "e\nP") 1232 (interactive "e")
1233 (if (featurep 'xemacs) 1233 (if (featurep 'xemacs)
1234 (term-send-raw-string 1234 (term-send-raw-string
1235 (or (condition-case () (x-get-selection) (error ())) 1235 (or (condition-case () (x-get-selection) (error ()))
@@ -1238,10 +1238,17 @@ without any interpretation."
1238 (run-hooks 'mouse-leave-buffer-hook) 1238 (run-hooks 'mouse-leave-buffer-hook)
1239 (setq this-command 'yank) 1239 (setq this-command 'yank)
1240 (mouse-set-point click) 1240 (mouse-set-point click)
1241 (term-send-raw-string (current-kill (cond 1241 (term-send-raw-string
1242 ((listp arg) 0) 1242 (or (cond ; From `mouse-yank-primary':
1243 ((eq arg '-) -1) 1243 ((eq system-type 'windows-nt)
1244 (t (1- arg))))))) 1244 (or (x-get-selection 'PRIMARY)
1245 (x-get-selection-value)))
1246 ((fboundp 'x-get-selection-value)
1247 (or (x-get-selection-value)
1248 (x-get-selection 'PRIMARY)))
1249 (t
1250 (x-get-selection 'PRIMARY)))
1251 (error "No selection is available")))))
1245 1252
1246(defun term-paste () 1253(defun term-paste ()
1247 "Insert the last stretch of killed text at point." 1254 "Insert the last stretch of killed text at point."