guile-user
[Top][All Lists]
Advanced

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

Re: Getting the (text) selection from the clipboard


From: Kjetil S. Matheussen
Subject: Re: Getting the (text) selection from the clipboard
Date: Sat, 20 Jun 2009 13:18:17 +0200 (CEST)


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 via email to

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