all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: "Ehud Karni" <ehud@unix.mvs.co.il>
To: drew.adams@oracle.com
Cc: emacs-devel@gnu.org
Subject: Re: FW: yank-secondary
Date: Tue, 12 Feb 2008 17:33:59 +0200	[thread overview]
Message-ID: <200802121533.m1CFXxCw023209@beta.mvs.co.il> (raw)
In-Reply-To: <000501c86c16$c987a710$2958908d@us.oracle.com> (message from Drew Adams on Sun, 10 Feb 2008 10:57:30 -0800)

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




  parent reply	other threads:[~2008-02-12 15:33 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
  -- strict thread matches above, loose matches on Subject: below --
2008-03-11 18:59 Drew Adams

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200802121533.m1CFXxCw023209@beta.mvs.co.il \
    --to=ehud@unix.mvs.co.il \
    --cc=drew.adams@oracle.com \
    --cc=emacs-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.