You are not logged in.

#1 2010-02-18 10:48:01

nschoe
Member
Registered: 2009-10-29
Posts: 23
Website

Copying within emacs (console), irssi, or xterm

Hi,

Thanks for taking time to read this post, I know I have already read something on your forums on this topic, but I'm unable to find it (used the 'Search' but didn't find it) so I apologize if you have already answered this.

My problem is I dunnow how to copy from a "window in console", for instance I'm used to code under emacs, with the -nw option activated, but when I want to copy/paste some code from my emacs to, say my browser (on hpaste.org for example) I can't do, because I don't know how to copy the selected text.
And the converse is true too : when I copied some code from my browser, I don't know how to put it to the file I'm editing with emacs.
Another example is when I have a long command from the web I must issue in xterm, I have to write the whole command by hand, and I have the same problem when users post links in irssi, because I can't coy them to my browser.

Can you help me, or give me the link to the board that already deals with that problem ? I'm sorry I ask for something that has already been solved.

Thank you anyway !


The important thing is not to stop questioning.
If you can't explain something simply, you don't know enough about it.

Offline

#2 2010-02-18 11:12:54

lustikus
Member
Registered: 2009-11-10
Posts: 262

Re: Copying within emacs (console), irssi, or xterm

copy/paste in emacs is M-w (copy) and C-y (paste)
copy/paste in browser (in my case chromium) is C-c / C-v
To copy text from emacs to browser I mark it in emacs (mouse or C-space) go to chromium and press C-v. Copy text from chromium to emacs is C-c in chromium and C-y in emacs.
In console you can paste with shift-ins or middle mouse.

Last edited by lustikus (2010-02-18 11:15:25)

Offline

#3 2010-02-18 11:28:00

nschoe
Member
Registered: 2009-10-29
Posts: 23
Website

Re: Copying within emacs (console), irssi, or xterm

Thank you lustikus,

When I mark text (with C-Space) then M-w (copy) move in another place in the file an yank (C-y) it works, I have my text written. Thank you for that.

Inside my browser, the C-c / C-v combination works perfectly, I knew it, it's well-known shortcut.

To copy text from chromium (I use it too) to my emacs *console* window, the method you said didn't work, but, when I copy text from chromium with C-c, then switch to my emacs window, I can have my text pasted with the shift + insert combination you said, thank you for that : I'm now able to copy text from any source (chromium) to my conole/emacs.

However, I can't do the converse : I didn't manage to get text from emacs/console to another place such as chromium : I tried to mark text in emacs, then switch to chromium and C-v : nothing. I tried to mark text in emacs, then M-w it, then switch to chromium and C-v : nothing hmm

Do you see any method that can work ? The combination of shift + insert works good in interacting between GUI and console application, is there the equivalent to interact  between console and GUI ?

Thanks !


The important thing is not to stop questioning.
If you can't explain something simply, you don't know enough about it.

Offline

#4 2010-02-18 11:56:50

lustikus
Member
Registered: 2009-11-10
Posts: 262

Re: Copying within emacs (console), irssi, or xterm

I just tested the combinations as I told you and they work for me.
I can copy with M-w in emacs and paste it with C-v in chromium and the other way round.
Perhaps some other app conflicts with keybindings. It may also depend on the windowmanager/desktop environment you use.
Also try C-ins for copy and Shift-ins for paste in your console.

You may also open xclipboard to see what's in your clipboard or get xclip to use it from the command lnie.

Offline

#5 2010-02-18 12:37:02

nschoe
Member
Registered: 2009-10-29
Posts: 23
Website

Re: Copying within emacs (console), irssi, or xterm

I've just tried again, and there is no way I can copy something from my emacs window. When I C-Space I do have the 'mark set' message, then I C-f several times so that I have some text highlighted. I then ESP-w (The combination ALT-w doesn't work, I don't know why but it displays a strange character), after ESP-w I switch to chromium but a right click doesn't allow me to 'Paste', and C-v doesn't display anything : as if nothing were in the clipboard (which I am going to check right now). However, C-y works perfectly in emacs after having ESC-w.

I use xterm under Xmonad as a WM.

Any idea ?

EDIT : I have fire xclipboard up when I was testing the commands. And predicted, when I mark text under emacs, then ESP-w it, nothing appears in the xclipboard.
Do you have any clue how I could manage to have some text from emacs go to the xclipboard ?
Thanks in advance.

Last edited by nschoe (2010-02-18 12:50:06)


The important thing is not to stop questioning.
If you can't explain something simply, you don't know enough about it.

Offline

#6 2010-02-18 12:49:06

Misfit138
Misfit Emeritus
From: USA
Registered: 2006-11-27
Posts: 4,189

Re: Copying within emacs (console), irssi, or xterm

Maybe you could try to install and use a clipboard manager like glipper or something. smile

Offline

#7 2010-02-18 12:52:16

nschoe
Member
Registered: 2009-10-29
Posts: 23
Website

Re: Copying within emacs (console), irssi, or xterm

Misfit138 : I thought so, tell me if I'm wrong but I think installing a clipboard manager would be useful if I wanted to copy some text from, let's say chromium to emacs, but I can do that thanks to ALT + insert. What I want is the converse : copy text from an emacs console window, and have it in teh clipboard so that I can paste it under, let's say chromium.


The important thing is not to stop questioning.
If you can't explain something simply, you don't know enough about it.

Offline

#8 2010-02-18 12:57:41

Misfit138
Misfit Emeritus
From: USA
Registered: 2006-11-27
Posts: 4,189

Re: Copying within emacs (console), irssi, or xterm

Yes..hmmmm.
Well, I use vim and nano, and I use floating window managers, so I typically highlight and paste with the mouse, so I don't quite know if this would work with keyboard s/c. I do know that this clipboard/copy/paste issue is the cause of general frustration for a lot of users on all distros.
I would still try installing a clipman though; you could always uninstall if it does not work.

Offline

#9 2010-02-18 13:04:47

nschoe
Member
Registered: 2009-10-29
Posts: 23
Website

Re: Copying within emacs (console), irssi, or xterm

I will try to install glipper, but how can I solve my problem ? Even if I we found a solution involving the mouse it would be good for me. But under emacs, when I select some text with the mouse, how can I 'save' it to the clipboard ?


The important thing is not to stop questioning.
If you can't explain something simply, you don't know enough about it.

Offline

#10 2010-02-18 13:22:38

Misfit138
Misfit Emeritus
From: USA
Registered: 2006-11-27
Posts: 4,189

Re: Copying within emacs (console), irssi, or xterm

Well, clipboard programs are pretty nice; they sit in the background, caching selected and copied text. In this case, I don't think you would need any further intervention other than installing it and having it run when Xmonad starts. Then the next time you select or copy text, it *should* be cached by the clipman, ready for pasting.

Offline

#11 2011-01-29 22:53:03

imbroglio
Member
Registered: 2011-01-29
Posts: 1

Re: Copying within emacs (console), irssi, or xterm

I'm responding to this query so that the correct answer is somewhere on this page.

The m-w copy command on some versions of emacs is defined as 'kill-ring-save'.
To get the clipboard into the act, you need to redefine it as 'clipboard-kill-ring-save'.
What I do:  in my ~/.emacs file I add a line:

   (define-key global-map  "\ew" 'clipboard-kill-ring-save)

Then when you restart emacs*, m-w will always save to the system clipboard.  It has been said that clipboard copy is slower than internal emacs copy, but it is still a heck of a lot faster than using mouse and menu when you want a clipboard copy (and I often do).

Control-y seems to interact fine with the system clipboard for me out of the box.
===
*Note:  You can check that it worked by going to the end of the inserted line (after the closing paren) and keying the chord: control-x control-e.  That will eval the expression and give you clipboard copy right away.

Offline

Board footer

Powered by FluxBB