[Top][All Lists]

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


From: Björn Lindström
Subject: interprogram-cut/paste-functions
Date: Tue, 02 Aug 2005 14:52:25 +0200
User-agent: Gnus/5.110004 (No Gnus v0.4) Emacs/22.0.50 (gnu/linux)

I'm trying to get my text mode Emacs session to interoperate with my X
clipboard, using xsel (

The following sort of works, except that when I yank something in Emacs,
the empty string gets pushed to kill-ring. I suspect that I
misunderstand when interprogram-paste-function is supposed to return
nil, but I need help figuring out how.

Here's my attempt so far:

(defun bkhl-cut-function (text &optional push)
      (insert text)
      (call-process-region (point-min) (point-max) "xsel" nil 0 "--input")))
(setq interprogram-cut-function 'bkhl-cut-function)

(defun bkhl-paste-function ()
  (let ((text (with-output-to-string
                (with-current-buffer standard-output
                  (call-process "xsel" nil standard-output nil "--output")))))
    (unless (string= (car kill-ring) text)
(setq interprogram-paste-function 'bkhl-paste-function)

reply via email to

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