unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: Emanuel Berg <embe8573@student.uu.se>
To: help-gnu-emacs@gnu.org
Subject: Re: How to copy and paste from unity to emacs in the terminal version ?
Date: Sat, 16 Aug 2014 23:45:31 +0200	[thread overview]
Message-ID: <87r40ghzwk.fsf@debian.uxu> (raw)
In-Reply-To: mailman.7137.1408188625.1147.help-gnu-emacs@gnu.org

Quanyang Liu <lqymgt@gmail.com> writes:

> 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 "--clipboar=
> d" "--input")))
> 	(defun xsel-paste-function()
> 	  (let ((xsel-output (shell-command-to-string "xsel --clipboard --output")=
> ))
> 		(unless (string=3D (car kill-ring) xsel-output)
> 		  xsel-output )))
> 	(setq interprogram-cut-function 'xsel-cut-function)
> 	(setq interprogram-paste-function 'xsel-paste-function)
> 	))

Amazing! I have almost the same, also based on xsel. I
made it into a package [1], but then I learned another
guy had submitted a package to ELPA, only based on
xclip (which I first used, but dropped for some reason
in favor of xsel).

So I never submitted it, but perhaps I still will.

Both xsel and xclip are in the repositories for Debian
and surely for Ubuntu as well (if you are using Unity,
I mean).

Also, if you are using tmux, I wrote some code [2] so
that you can insert what you kill in tmux into an Emacs
buffer. The Emacs kill-yank keys are at work by default
in tmux, I think, but tmux requires a little love [3]
to write the killed region to a file, which is then
inserted from Emacs.

Good luck!

[1] http://user.it.uu.se/~embe8573/conf/emacs-init/xsel.el
[2] http://user.it.uu.se/~embe8573/conf/emacs-init/linux-shell.el
[3] http://user.it.uu.se/~embe8573/conf/.tmux.conf

-- 
underground experts united


  parent reply	other threads:[~2014-08-16 21:45 UTC|newest]

Thread overview: 42+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-08-16  8:57 How to copy and paste from unity to emacs in the terminal version ? Kro Ly
     [not found] ` <7zmwb4vggo.fsf@example.com>
2014-08-16 11:29   ` Quanyang Liu
2014-08-16 12:51     ` Grant Rettke
     [not found]   ` <mailman.7137.1408188625.1147.help-gnu-emacs@gnu.org>
2014-08-16 21:45     ` Emanuel Berg [this message]
2014-08-17  1:16       ` Quanyang Liu
     [not found]       ` <mailman.7148.1408238240.1147.help-gnu-emacs@gnu.org>
2014-08-17  2:26         ` Emanuel Berg
2014-08-18 15:22     ` Kro Ly
2014-08-18 15:37       ` Yuri Khan
     [not found]       ` <7zy4ulojs7.fsf@example.com>
2014-08-18 17:45         ` Subhan Michael Tindall
2014-08-18 17:54           ` Bob Proulx
2014-08-18 18:20             ` Stefan Monnier
2014-08-19  0:17               ` Bob Proulx
2014-08-19  1:41                 ` Stefan Monnier
2014-08-18 21:41         ` Emanuel Berg
2014-08-18 22:11           ` Emanuel Berg
     [not found]           ` <7z7g25za4u.fsf@example.com>
2014-08-18 23:03             ` Emanuel Berg
     [not found]               ` <7zsiksvpg9.fsf@example.com>
2014-08-19 16:49                 ` Emanuel Berg
2014-08-19 22:59                   ` Emanuel Berg
     [not found]       ` <mailman.7192.1408376274.1147.help-gnu-emacs@gnu.org>
2014-08-18 20:12         ` Kro Ly
2014-08-19  2:41           ` Yuri Khan
2014-08-20  5:40             ` Bob Proulx
     [not found]             ` <mailman.7266.1408513264.1147.help-gnu-emacs@gnu.org>
2014-08-20 17:28               ` Emanuel Berg
2014-08-21  3:43                 ` Yuri Khan
     [not found]                 ` <mailman.7303.1408592631.1147.help-gnu-emacs@gnu.org>
2014-08-22  0:09                   ` Emanuel Berg
2014-08-16 23:18 ` Emanuel Berg
2014-08-17  1:22   ` Quanyang Liu
     [not found]   ` <mailman.7149.1408238590.1147.help-gnu-emacs@gnu.org>
2014-08-17  2:34     ` Emanuel Berg
     [not found]   ` <7zvbpr8qxe.fsf@example.com>
     [not found]     ` <87sikv9cal.fsf_-_@debian.uxu>
2014-08-17 19:45       ` how to determine if to reply by CC as well (was: Re: How to copy and paste from unity to emacs in the terminal version ?) Emanuel Berg
     [not found]         ` <7zoavin7e5.fsf@example.com>
2014-08-17 21:53           ` how to determine if to reply by CC as well Emanuel Berg
2014-08-18  0:27             ` Quanyang Liu
2014-08-18 17:46               ` Bob Proulx
2014-08-19  9:07                 ` Quanyang Liu
     [not found]               ` <mailman.7199.1408384010.1147.help-gnu-emacs@gnu.org>
2014-08-18 21:56                 ` Emanuel Berg
2014-08-19  0:30                   ` Bob Proulx
     [not found]                   ` <mailman.7218.1408408231.1147.help-gnu-emacs@gnu.org>
2014-08-19  1:22                     ` Emanuel Berg
2014-08-19 14:25                       ` Will Parsons
2014-08-19 14:59                         ` Quanyang Liu
2014-08-19 17:06                         ` Emanuel Berg
2014-08-18 12:57 ` How to copy and paste from unity to emacs in the terminal version ? Robert Thorpe
2014-08-18 15:46 ` Stefan Monnier
     [not found] <7z38cuorvf.fsf@example.com>
2014-08-18 19:02 ` Robert Thorpe
2014-08-18 20:44   ` Dale Snell

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/emacs/

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

  git send-email \
    --in-reply-to=87r40ghzwk.fsf@debian.uxu \
    --to=embe8573@student.uu.se \
    --cc=help-gnu-emacs@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).