all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* FW: yank-secondary
@ 2008-02-10 18:57 Drew Adams
  2008-02-11 15:38 ` David De La Harpe Golden
  2008-02-12 15:33 ` Ehud Karni
  0 siblings, 2 replies; 4+ messages in thread
From: Drew Adams @ 2008-02-10 18:57 UTC (permalink / raw)
  To: Emacs-Devel

Resending. Questions:
 
1) Any interest? 
2) Do you yank the secondary selection (without the mouse)? If so, how?

-------------
Sent: Wednesday, January 30, 2008 1:41 PM
Any interest in adding something like this? I've used it for years. Hard to
believe it isn't already in Emacs (or is it?). (What do those of you who are
sans souris use?)

(defun yank-secondary ()
  "Insert the secondary selection at point.
Moves point to the end of the inserted text.  Does not change mark."
  (interactive)
  (let ((secondary (x-get-selection 'SECONDARY)))
    (unless secondary (error "No secondary selection"))
    (insert secondary)))

I bind it to `C-M-y', so I can access two different selections from the
keyboard.

(FWIW, I also bind the meta mouse stuff to `C-M-', so mouse-yank-secondary
and yank-secondary use the same modifiers. I've done that since I had an SGI
workstation that wouldn't pass ALT-mouse stuff to Emacs. So, e.g., I have
`C-M-y' = yank-secondary, `C-M-mouse2' = mouse-yank-secondary, `C-M-mouse-1'
= mouse-start-secondary, `C-M-mouse-3' = mouse-secondary-save-then-kill,
`C-M-drag-mouse-1' = mouse-set-secondary, and `C-M-down-mouse-1' =
mouse-drag-secondary.)








^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: FW: yank-secondary
  2008-02-10 18:57 FW: yank-secondary Drew Adams
@ 2008-02-11 15:38 ` David De La Harpe Golden
  2008-02-12 15:33 ` Ehud Karni
  1 sibling, 0 replies; 4+ messages in thread
From: David De La Harpe Golden @ 2008-02-11 15:38 UTC (permalink / raw)
  To: Drew Adams; +Cc: Emacs-Devel

On 10/02/2008, Drew Adams <drew.adams@oracle.com> wrote:
> Resending. Questions:
>
> 1) Any interest?

For symmetry... maybe.

> 2) Do you yank the secondary selection (without the mouse)? If so, how?
>

I do very occasionally use secondary, but have always inserted it with
the mouse to date.  That maybe simply be because it's only easy to
/set/ it with the mouse in the first place, so if I'm using secondary,
I'm already mousing.




^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: FW: yank-secondary
  2008-02-10 18:57 FW: yank-secondary Drew Adams
  2008-02-11 15:38 ` David De La Harpe Golden
@ 2008-02-12 15:33 ` Ehud Karni
  1 sibling, 0 replies; 4+ messages in thread
From: Ehud Karni @ 2008-02-12 15:33 UTC (permalink / raw)
  To: drew.adams; +Cc: emacs-devel

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




^ permalink raw reply	[flat|nested] 4+ messages in thread

* FW: yank-secondary
@ 2008-03-11 18:59 Drew Adams
  0 siblings, 0 replies; 4+ messages in thread
From: Drew Adams @ 2008-03-11 18:59 UTC (permalink / raw)
  To: 'Emacs-Devel'

Resending. Questions:
 
1) Any interest? 
2) Do you yank the secondary selection (without the mouse)? If so, how?

-------------
Sent: Wednesday, January 30, 2008 1:41 PM
Any interest in adding something like this? I've used it for years. Hard to
believe it isn't already in Emacs (or is it?). (What do those of you who are
sans souris use?)

(defun yank-secondary ()
  "Insert the secondary selection at point.
Moves point to the end of the inserted text.  Does not change mark."
  (interactive)
  (let ((secondary (x-get-selection 'SECONDARY)))
    (unless secondary (error "No secondary selection"))
    (insert secondary)))

I bind it to `C-M-y', so I can access two different selections from the
keyboard.

(FWIW, I also bind the meta mouse stuff to `C-M-', so mouse-yank-secondary
and yank-secondary use the same modifiers. I've done that since I had an SGI
workstation that wouldn't pass ALT-mouse stuff to Emacs. So, e.g., I have
`C-M-y' = yank-secondary, `C-M-mouse2' = mouse-yank-secondary, `C-M-mouse-1'
= mouse-start-secondary, `C-M-mouse-3' = mouse-secondary-save-then-kill,
`C-M-drag-mouse-1' = mouse-set-secondary, and `C-M-down-mouse-1' =
mouse-drag-secondary.)











^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2008-03-11 18:59 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-02-10 18:57 FW: yank-secondary Drew Adams
2008-02-11 15:38 ` David De La Harpe Golden
2008-02-12 15:33 ` Ehud Karni
  -- strict thread matches above, loose matches on Subject: below --
2008-03-11 18:59 Drew Adams

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.