[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: FW: yank-secondary
From: |
Ehud Karni |
Subject: |
Re: FW: yank-secondary |
Date: |
Tue, 12 Feb 2008 17:33:59 +0200 |
On Sun, 10 Feb 2008 10:57:30 -0800, Drew Adams wrote:
>
> Resending. Questions:
>
> 1) Any interest?
> 2) Do you yank the secondary selection (without the mouse)? If so, how?
I do use various selections so I wrote the all purpose `insert-selection'.
(defun insert-select (&optional TYPE)
"Insert text from 'PRIMARY (x-get-selection) or CUT-BUFFER (x-get-cut-buffer)
clipboard (mouse selected). The 'CUT-BUFFER is used for Xvnc
Optional arg TYPE can specify the selection:
1-PRIMARY, 2-SECONDARY, 3-CLIPBOARD,
10-17 - cut buffer 0-7"
(interactive "P")
(or TYPE (setq TYPE 0))
(insert (or (cond
((= TYPE 1)
(x-get-selection 'PRIMARY 'STRING))
((= TYPE 2)
(x-get-selection 'SECONDARY 'STRING))
((= TYPE 3)
(x-get-selection 'CLIPBOARD 'STRING))
((and (> TYPE 9) (< TYPE 18))
(x-get-cut-buffer (- TYPE 10)))
;; default action (no/wrong TYPE)
(t
(if (eq window-system 'w32)
(x-get-selection-value)
;else
(if (getenv "VNCDESKTOP")
(x-get-cut-buffer)
(x-get-selection))))
) "")))
Remarks: Check before use !
Test it on w32 too - I did not use NTEmacs for at least 3 years.
The "VNCDESKTOP" test is used for Emacs used through VNC on UNIX.
Even when used through VNC you may want the other options.
e.g. If you marked text on Mozilla/Firefox you will need the
'CLIPBOARD (type=3), not the cut-buffer (used with xterm/rxvt).
Ehud.
--
Ehud Karni Tel: +972-3-7966-561 /"\
Mivtach - Simon Fax: +972-3-7966-667 \ / ASCII Ribbon Campaign
Insurance agencies (USA) voice mail and X Against HTML Mail
http://www.mvs.co.il FAX: 1-815-5509341 / \
GnuPG: 98EA398D <http://www.keyserver.net/> Better Safe Than Sorry