emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] /srv/bzr/emacs/trunk r105521: * lisp/term.el (term-mouse-p


From: Chong Yidong
Subject: [Emacs-diffs] /srv/bzr/emacs/trunk r105521: * lisp/term.el (term-mouse-paste): Yank primary selection (Bug#6845).
Date: Sun, 21 Aug 2011 13:56:19 -0400
User-agent: Bazaar (2.3.1)

------------------------------------------------------------
revno: 105521
committer: Chong Yidong <address@hidden>
branch nick: trunk
timestamp: Sun 2011-08-21 13:56:19 -0400
message:
  * lisp/term.el (term-mouse-paste): Yank primary selection (Bug#6845).
modified:
  lisp/ChangeLog
  lisp/term.el
=== modified file 'lisp/ChangeLog'
--- a/lisp/ChangeLog    2011-08-21 17:43:31 +0000
+++ b/lisp/ChangeLog    2011-08-21 17:56:19 +0000
@@ -1,5 +1,7 @@
 2011-08-21  Chong Yidong  <address@hidden>
 
+       * term.el (term-mouse-paste): Yank primary selection (Bug#6845).
+
        * emacs-lisp/find-func.el (find-function-noselect): New arg
        lisp-only.
 

=== modified file 'lisp/term.el'
--- a/lisp/term.el      2011-05-23 17:57:17 +0000
+++ b/lisp/term.el      2011-08-21 17:56:19 +0000
@@ -1227,9 +1227,9 @@
                              (make-string 1 char)
                            (format "\e%c" char)))))
 
-(defun term-mouse-paste (click arg)
-  "Insert the last stretch of killed text at the position clicked on."
-  (interactive "e\nP")
+(defun term-mouse-paste (click)
+  "Insert the primary selection at the position clicked on."
+  (interactive "e")
   (if (featurep 'xemacs)
       (term-send-raw-string
        (or (condition-case () (x-get-selection) (error ()))
@@ -1238,10 +1238,17 @@
     (run-hooks 'mouse-leave-buffer-hook)
     (setq this-command 'yank)
     (mouse-set-point click)
-    (term-send-raw-string (current-kill (cond
-                                        ((listp arg) 0)
-                                        ((eq arg '-) -1)
-                                        (t (1- arg)))))))
+    (term-send-raw-string
+     (or (cond  ; From `mouse-yank-primary':
+         ((eq system-type 'windows-nt)
+          (or (x-get-selection 'PRIMARY)
+              (x-get-selection-value)))
+         ((fboundp 'x-get-selection-value)
+          (or (x-get-selection-value)
+              (x-get-selection 'PRIMARY)))
+         (t
+          (x-get-selection 'PRIMARY)))
+        (error "No selection is available")))))
 
 (defun term-paste ()
   "Insert the last stretch of killed text at point."


reply via email to

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