help-gnu-emacs
[Top][All Lists]
Advanced

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

Re: How to copy and paste from unity to emacs in the terminal version ?


From: Quanyang Liu
Subject: Re: How to copy and paste from unity to emacs in the terminal version ?
Date: Sat, 16 Aug 2014 19:29:49 +0800
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux)

On Sat, Aug 16 2014 at 19:09:27 +0800, David Hume wrote:
> Kro Ly <mnmnmnmna@gmail.com> writes:
>
>> Hi, i'm using emacs in the terminal and I'd like to know how to copy
>> and paste something from firefox to emacs for instance ?
>> Thanks.
>
> That depends on the terminal I think. If it is xterm you can press the
> middle mouse button to paste.
Maybe you can try to use xsel. The way I use is below:

;; use xsel to copy/paste in emacs-nox
(unless window-system
  (when (getenv "DISPLAY")
        (defun xsel-cut-function (text &optional push)
          (with-temp-buffer
                (insert text)
                (call-process-region (point-min) (point-max) "xsel" nil 0 nil 
"--clipboard" "--input")))
        (defun xsel-paste-function()
          (let ((xsel-output (shell-command-to-string "xsel --clipboard 
--output")))
                (unless (string= (car kill-ring) xsel-output)
                  xsel-output )))
        (setq interprogram-cut-function 'xsel-cut-function)
        (setq interprogram-paste-function 'xsel-paste-function)
        ))
    
-- 
Quanyang Liu (刘全阳)
Undergraduate
Department of Computer Science and Engineering
Shanghai Jiao Tong University



reply via email to

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