all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Re:Copy Paste in no-x11 mode (emacs -nw)
@ 2008-09-25 19:12 Simeon Nifos
  2008-09-26  8:17 ` Copy " Nikolaj Schumacher
       [not found] ` <mailman.19983.1222417070.18990.help-gnu-emacs@gnu.org>
  0 siblings, 2 replies; 6+ messages in thread
From: Simeon Nifos @ 2008-09-25 19:12 UTC (permalink / raw)
  To: help-gnu-emacs

> Message: 9
> Date: Thu, 25 Sep 2008 13:43:51 -0400
> From: Dan Espen <daneNO@MORE.mk.SPAMtelcordia.com>
> Subject: Re: Copy Paste in no-x11 mode (emacs -nw)
> To: help-gnu-emacs@gnu.org
> Message-ID: <icskrorui0.fsf@verizon.net>
> Content-Type: text/plain; charset=us-ascii
>
> "Simeon Nifos" <archwndas@googlemail.com> writes:
>
>> Dear list,
>> I like using emacs in nox11 mode. The Eterm terminal provides a great
>> font by default I really enjoy. It is smaller and I can work on more
>> source code than I do with the misc-fixed font of Xterm. So I usually
>> run emacs  with -nw. Unfortunately there is no way to copy paste
>> something from one emacs window to a terminal or from a terminal to
>> the emacs window I am editing. This is a real headache, since one of
>> the most foundamental stuff an editor is supposed to do, is to support
>> copy and paste of text from whatsoever source to the window where
>> editing takes place.
>
> No.

Really? Why not? Why so fundamental things which is common sense
are so easilly thrown into trash from Unixers? I love Unix myself. But ...
it could have been made much better and much popular if it allowed
what a person expects to have out of the box ... And I am not talking
about fancy (or should I call them stupid) KDE stuff.

> Copy/Paste is a function of the terminal, not Emacs, when you run
> Emacs in a terminal.

Hmmm, it seems however that VIM does it. I am working on the same
Eterm, terminal with VIM and the same thing works like a charm. Why
shouldn't it work with the famous EMACS as well? There are more
things in EMACS than there are in VIM, like debug, like autoformating
of text and C++ comments, and LaTeX documents which are enabled
by default in EMACS and not in VIM. If only the copy paste worked.
I would not need to abandon EMACS at all. Now I do.

>> Is there anyway I could activate this "underestimated" feature in the
>> mode I am using emacs? I apologize if this email sounds aggressive but
>> there are some things an editor is supposed to do by default and I
>> cannot understand why they are turned off in emacs.
>
> I don't know why you are having problems doing copy/paste in a terminal.
> You need to supply more information.  What OS are you using, what did you
> do, what happened.  What did you expect to happen.

Can you? I am using Linux. But the same holds for FreeBSD, Solaris.
Look what I get when I try to paste something on the terminal where
EMACS runs; I mean paste something outside emacs from another
emacs window or vim window or the browser. This is what is reported
  down in the command-buffer: "Kill ring is empty"

I do have enabled the following in my .emacs:
====================
(xterm-mouse-mode t)
(mouse-wheel-mode t)
(setq x-select-enable-clipboard t)
=====================

Anything else to try? Can you copy paste in terminal? And it makes no
difference if I use XTerm or Eterm. In both the Kill ring is empty.




^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Copy Paste in no-x11 mode (emacs -nw)
  2008-09-25 19:12 Re:Copy Paste in no-x11 mode (emacs -nw) Simeon Nifos
@ 2008-09-26  8:17 ` Nikolaj Schumacher
  2008-09-26  9:02   ` Thierry Volpiatto
       [not found] ` <mailman.19983.1222417070.18990.help-gnu-emacs@gnu.org>
  1 sibling, 1 reply; 6+ messages in thread
From: Nikolaj Schumacher @ 2008-09-26  8:17 UTC (permalink / raw)
  To: Simeon Nifos; +Cc: help-gnu-emacs

"Simeon Nifos" <archwndas@googlemail.com> wrote:

>> "Simeon Nifos" <archwndas@googlemail.com> writes:
>>
>>> Dear list,
>>> I like using emacs in nox11 mode. The Eterm terminal provides a great
>>> font by default I really enjoy. It is smaller and I can work on more
>>> source code than I do with the misc-fixed font of Xterm. So I usually
>>> run emacs  with -nw.

Please note that running without -nw is very different from running in
Xterm.  I'm not sure if you're clear on that (based on that sentence).

Running it in X gives you a very configurable appearance, including free
choice of font and size.

>>> This is a real headache, since one of the most foundamental stuff an
>>> editor is supposed to do, is to support copy and paste of text from
>>> whatsoever source to the window where editing takes place.
>>
>> No.
>
> Really? Why not? Why so fundamental things which is common sense
> are so easilly thrown into trash from Unixers?

I think he was not saying that Emacs shouldn't do it, but that Emacs
can't do it.  When you copy from "whatsoever" source, you copy using it
using X, right?  But since Emacs runs in a terminal, it doesn't have
access to X, only the terminal has.  It is all abstracted away by the
terminal.

Now, terminals generally support copy & paste with the regular Ctrl+c
and Ctrl+v shortcuts (sometimes Ctrl+Shift+c).  They then pass this text
to the program (Emacs) as input.  Emacs has no way of knowing that this
was pasted, not entered on the keyboard.

>> Copy/Paste is a function of the terminal, not Emacs, when you run
>> Emacs in a terminal.
>
> Hmmm, it seems however that VIM does it. I am working on the same
> Eterm, terminal with VIM and the same thing works like a charm. Why
> shouldn't it work with the famous EMACS as well?

What are you using to paste in vim.  "p"?  To my knowledge that
shouldn't work, either.  (And doesn't, on my machine.)

> Can you? I am using Linux. But the same holds for FreeBSD, Solaris.
> Look what I get when I try to paste something on the terminal where
> EMACS runs; I mean paste something outside emacs from another
> emacs window or vim window or the browser. This is what is reported
>   down in the command-buffer: "Kill ring is empty"

As I said above, Emacs can't get access to the X clipboard.  Only the
terminal can.  You can use your terminal's paste function, if it has
one, though.



regards,
Nikolaj Schumacher




^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Copy Paste in no-x11 mode (emacs -nw)
       [not found] ` <mailman.19983.1222417070.18990.help-gnu-emacs@gnu.org>
@ 2008-09-26  8:57   ` Joost Kremers
  2008-09-26 10:35     ` Thierry Volpiatto
  0 siblings, 1 reply; 6+ messages in thread
From: Joost Kremers @ 2008-09-26  8:57 UTC (permalink / raw)
  To: help-gnu-emacs

Nikolaj Schumacher wrote:
> As I said above, Emacs can't get access to the X clipboard.  Only the
> terminal can.  You can use your terminal's paste function, if it has
> one, though.

or you can use X's general copy/paste function using the mouse: select text
with button1, paste it with button2 (i.e. the middle button on a
three-button mouse. which on a two-button mouse is often emulated by
clicking both buttons simultaneously.)


-- 
Joost Kremers                                      joostkremers@yahoo.com
Selbst in die Unterwelt dringt durch Spalten Licht
EN:SiS(9)


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Copy Paste in no-x11 mode (emacs -nw)
  2008-09-26  8:17 ` Copy " Nikolaj Schumacher
@ 2008-09-26  9:02   ` Thierry Volpiatto
  2008-09-26 12:04     ` Jonathan Groll
  0 siblings, 1 reply; 6+ messages in thread
From: Thierry Volpiatto @ 2008-09-26  9:02 UTC (permalink / raw)
  To: Nikolaj Schumacher; +Cc: Simeon Nifos, help-gnu-emacs

Nikolaj Schumacher <me@nschum.de> writes:

> "Simeon Nifos" <archwndas@googlemail.com> wrote:
>
>>> "Simeon Nifos" <archwndas@googlemail.com> writes:
>>>
>>>> Dear list,
>>>> I like using emacs in nox11 mode. The Eterm terminal provides a great
>>>> font by default I really enjoy. It is smaller and I can work on more
>>>> source code than I do with the misc-fixed font of Xterm. So I usually
>>>> run emacs  with -nw.
>
> Please note that running without -nw is very different from running in
> Xterm.  I'm not sure if you're clear on that (based on that sentence).
>
> Running it in X gives you a very configurable appearance, including free
> choice of font and size.
>
>>>> This is a real headache, since one of the most foundamental stuff an
>>>> editor is supposed to do, is to support copy and paste of text from
>>>> whatsoever source to the window where editing takes place.
>>>
>>> No.
>>
>> Really? Why not? Why so fundamental things which is common sense
>> are so easilly thrown into trash from Unixers?
>
> I think he was not saying that Emacs shouldn't do it, but that Emacs
> can't do it.  When you copy from "whatsoever" source, you copy using it
> using X, right?  But since Emacs runs in a terminal, it doesn't have
> access to X, only the terminal has.  It is all abstracted away by the
> terminal.
>
> Now, terminals generally support copy & paste with the regular Ctrl+c
> and Ctrl+v shortcuts (sometimes Ctrl+Shift+c).  They then pass this text
> to the program (Emacs) as input.  Emacs has no way of knowing that this
> was pasted, not entered on the keyboard.
>
>>> Copy/Paste is a function of the terminal, not Emacs, when you run
>>> Emacs in a terminal.
>>
>> Hmmm, it seems however that VIM does it. I am working on the same
>> Eterm, terminal with VIM and the same thing works like a charm. Why
>> shouldn't it work with the famous EMACS as well?
>
> What are you using to paste in vim.  "p"?  To my knowledge that
> shouldn't work, either.  (And doesn't, on my machine.)
>
>> Can you? I am using Linux. But the same holds for FreeBSD, Solaris.
>> Look what I get when I try to paste something on the terminal where
>> EMACS runs; I mean paste something outside emacs from another
>> emacs window or vim window or the browser. This is what is reported
>>   down in the command-buffer: "Kill ring is empty"
>
> As I said above, Emacs can't get access to the X clipboard.  Only the
> terminal can.  You can use your terminal's paste function, if it has
> one, though.
>
If you use screen, you can copy from there just like in emacs:
Assume screen prefix key is C-p: (default is C-a)

C-p [ ==> SPC ==> C-f or/and C-n ==> > 

Now you have a copy of the text in a file named ~/.screen_exchange
to set it, write in your .screenrc:  

,----
| bufferfile            $HOME/.screen_exchange
`----

Note: i think the default if you set nothing is /tmp/.screen_exchange
but i am not sure.

Now if you define a little function with a global-key like:

,----
| (defun tv-yank-from-screen ()
|   (interactive)
|   (insert-file-contents "~/.screen_exchange"))
| 
| (global-set-key (kbd "C-c Y") 'tv-yank-from-screen)
`----

you can now yank what you want from your terminal :)

-- 
A + Thierry Volpiatto
Location: Saint-Cyr-Sur-Mer - France




^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Copy Paste in no-x11 mode (emacs -nw)
  2008-09-26  8:57   ` Joost Kremers
@ 2008-09-26 10:35     ` Thierry Volpiatto
  0 siblings, 0 replies; 6+ messages in thread
From: Thierry Volpiatto @ 2008-09-26 10:35 UTC (permalink / raw)
  To: help-gnu-emacs

Second part, using screen to communicate (kill/yank)
between terminal/emacs.

With this code you can copy text in emacs and retrieve it in screen.

,----
| (defun tv-copy-for-screen (beg end)
|   (interactive "r")
|   (let ((k-region (buffer-substring-no-properties beg end))
|         (require-final-newline nil))
|     (save-excursion
|       (find-file "~/.screen_exchange")
|       (goto-char (point-min))
|       (erase-buffer)
|       (insert (replace-regexp-in-string "\n" "" k-region))
|       (save-buffer)
|       (kill-buffer (current-buffer)))))
| 
| (global-set-key (kbd "C-c C") 'tv-copy-for-screen)
`----

When you are in screen, first read paste-buffer with
"<screen-prefix-key> <"
and then paste with "<screen-prefix-key> ]"

-- 
A + Thierry Volpiatto
Location: Saint-Cyr-Sur-Mer - France




^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Copy Paste in no-x11 mode (emacs -nw)
  2008-09-26  9:02   ` Thierry Volpiatto
@ 2008-09-26 12:04     ` Jonathan Groll
  0 siblings, 0 replies; 6+ messages in thread
From: Jonathan Groll @ 2008-09-26 12:04 UTC (permalink / raw)
  To: Thierry Volpiatto; +Cc: help-gnu-emacs

On Fri, Sep 26, 2008 at 11:02:09AM +0200, Thierry Volpiatto wrote:
>If you use screen, you can copy from there just like in emacs:
>Assume screen prefix key is C-p: (default is C-a)
>
>C-p [ ==> SPC ==> C-f or/and C-n ==> > 
>
>Now you have a copy of the text in a file named ~/.screen_exchange
>to set it, write in your .screenrc:  
>
>,----
>| bufferfile            $HOME/.screen_exchange
>`----
>
>Note: i think the default if you set nothing is /tmp/.screen_exchange
>but i am not sure.
>
>Now if you define a little function with a global-key like:
>
>,----
>| (defun tv-yank-from-screen ()
>|   (interactive)
>|   (insert-file-contents "~/.screen_exchange"))
>| 
>| (global-set-key (kbd "C-c Y") 'tv-yank-from-screen)
>`----
>
>you can now yank what you want from your terminal :)
>

Also I must add since we all use Emacs C-a is an unacceptable screen
prefix key (it is the default). I much prefer the backtick, set using
the following in ~/.screenrc

escape ``

I will definitely add your screen functions to my personal elisp
library. Thanks!

Cheers,
Jonathan




^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2008-09-26 12:04 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-09-25 19:12 Re:Copy Paste in no-x11 mode (emacs -nw) Simeon Nifos
2008-09-26  8:17 ` Copy " Nikolaj Schumacher
2008-09-26  9:02   ` Thierry Volpiatto
2008-09-26 12:04     ` Jonathan Groll
     [not found] ` <mailman.19983.1222417070.18990.help-gnu-emacs@gnu.org>
2008-09-26  8:57   ` Joost Kremers
2008-09-26 10:35     ` Thierry Volpiatto

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.