unofficial mirror of guile-user@gnu.org 
 help / color / mirror / Atom feed
From: "Kjetil S. Matheussen" <k.s.matheussen@notam02.no>
To: guile-user@gnu.org
Subject: Re: Getting the (text) selection from the clipboard
Date: Sat, 20 Jun 2009 13:18:17 +0200 (CEST)	[thread overview]
Message-ID: <Pine.LNX.4.64-L.0906201314360.18357@anakin.ifi.uio.no> (raw)
In-Reply-To: <cmu-lmtpd-9891-1245341379-1@mail-imap1.uio.no>


Richard Shann:
>
> Does anyone know if there is a guile procedure to get the (text)
> selection? (That is from doing Copy in another application)
> Richard
>

Assuming you mean X selection, I've used the "xsel" program to do this:

(define-macro (include filename)
   (define ret "")
   (for-each-line-in-file (string-trim-right (eval-parse filename))
 			 (lambda (line)
 			   (set! ret (string-append ret line "\n"))))
   ret)

(define-macro (x11-selection)
   (define filename (tmpnam))
   (if (not (= 0 (system (string-append "xsel >" filename))))
       (display "Error. x11-selection requires the \"xsel\" program: http://www.vergenet.net/~conrad/software/xsel/")
       `(include ,filename)))





       reply	other threads:[~2009-06-20 11:18 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <cmu-lmtpd-9891-1245341379-1@mail-imap1.uio.no>
2009-06-20 11:18 ` Kjetil S. Matheussen [this message]
2009-06-18 18:09 Getting the (text) selection from the clipboard Richard Shann
  -- strict thread matches above, loose matches on Subject: below --
2009-06-17 21:06 Richard Shann
2009-06-17 22:22 ` Neil Jerram

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

  List information: https://www.gnu.org/software/guile/

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

  git send-email \
    --in-reply-to=Pine.LNX.4.64-L.0906201314360.18357@anakin.ifi.uio.no \
    --to=k.s.matheussen@notam02.no \
    --cc=guile-user@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.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).