all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Copy and Pasting in Emacs...
@ 2004-03-07 23:20 Patrick
  2004-03-08  0:34 ` Billy O'Connor
                   ` (3 more replies)
  0 siblings, 4 replies; 7+ messages in thread
From: Patrick @ 2004-03-07 23:20 UTC (permalink / raw)


i have just started to use emacs and unixy things..so apologies if
this seems a little simple\naive

I am currently using XEmacs on windows

To copy a line in emacs i 
(a)put the cursor at the beginning of the line
(b)press CTRL+SPACEBAR
(c)put the cursor at the end of the line
(d)press ALT+W (where ALT = metakey)

now the line is copied...

and to paste the copied line...

(e)press CTRL-Y


Now I have recently needed to use emacs on a remote machine (running
under linux).
I ssh into the machine from my computer (running windows) using ssh
from cygwin.
I open up emacs on this remote machine.
But the steps (a) to (e) above will not work, i cannot copy a line.

Anyone have any ideas where im going wrong? Im sure its pretty
trivial, ive searched the net but to no avail.

any help greatly appreciated.

regards,

pat

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

* Re: Copy and Pasting in Emacs...
  2004-03-07 23:20 Copy and Pasting in Emacs Patrick
@ 2004-03-08  0:34 ` Billy O'Connor
  2004-03-08  2:42 ` Benjamin Rutt
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 7+ messages in thread
From: Billy O'Connor @ 2004-03-08  0:34 UTC (permalink / raw)


googleaddress@yahoo.co.uk (Patrick) writes:

> Now I have recently needed to use emacs on a remote machine (running
> under linux).
> I ssh into the machine from my computer (running windows) using ssh
> from cygwin.

I'm guessing here, what does echo $TERM say when you first ssh in?

-- 
GNU/Linux revenues last quarter: $1 Billion.
micros~1  revenues last quarter: $4 Billion.
It's no longer a question of windows or GNU, it's a question of *Unix* or GNU.

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

* Re: Copy and Pasting in Emacs...
  2004-03-07 23:20 Copy and Pasting in Emacs Patrick
  2004-03-08  0:34 ` Billy O'Connor
@ 2004-03-08  2:42 ` Benjamin Rutt
  2004-03-08  4:36 ` Floyd L. Davidson
  2004-03-08 13:44 ` Stefan Monnier
  3 siblings, 0 replies; 7+ messages in thread
From: Benjamin Rutt @ 2004-03-08  2:42 UTC (permalink / raw)


googleaddress@yahoo.co.uk (Patrick) writes:

> Anyone have any ideas where im going wrong? Im sure its pretty
> trivial, ive searched the net but to no avail.

Try it more manually, with keys that should work regardless of
termcap/terminfo issues:

(a) goto the beginning of a line
(b) type Esc-x set-mark
(c) goto the end of a line
(d) press Esc-w

(e) press Ctrl-y to yank
-- 
Benjamin

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

* Re: Copy and Pasting in Emacs...
  2004-03-07 23:20 Copy and Pasting in Emacs Patrick
  2004-03-08  0:34 ` Billy O'Connor
  2004-03-08  2:42 ` Benjamin Rutt
@ 2004-03-08  4:36 ` Floyd L. Davidson
  2004-03-08 13:44 ` Stefan Monnier
  3 siblings, 0 replies; 7+ messages in thread
From: Floyd L. Davidson @ 2004-03-08  4:36 UTC (permalink / raw)


googleaddress@yahoo.co.uk (Patrick) wrote:
>i have just started to use emacs and unixy things..so apologies if
>this seems a little simple\naive
>
>I am currently using XEmacs on windows

One problem for the un-initiated is the ability to re-bind keys
to just about anything the user likes.  Hence it's hard to say
just what a specific set of key sequences will do once you have
anyone fooling with the configuration.

A second factor is that different terminals, and different kinds
of connections between the terminal and the host, cause hugely
varying results for certain key sequences.  For example, I doubt
that a CTRL+SPACEBAR works on many forms of remote connection to
a host, yet works fine when using the builtin system console.

You can go through your list of commands, one at a time, on your
Windows system, and determine the exact _functions_ being used
to accomplish your task.  Then on a remote system you can query
emacs about key bindings to learn which key sequences (if any)
can be used on that system.

  C-h k key-sequence

will tell you what the function name is.  Then, on the remote,

  M-x describe-bindings

will give you a list of all key bindings.  A quick search will
provide one (or more!) binding for any given function, or show
you that it can only be executed by name if there are no
bindings.

You then want to try the alternate bindings for things which
seem not to travel well over your network connection.

For example, here are the key sequences that I would use to do
what you describe:

>To copy a line in emacs i
>(a)put the cursor at the beginning of the line

  M-a        beginning-of-line

>(b)press CTRL+SPACEBAR

  M-space    set-mark-command

>(c)put the cursor at the end of the line

  M-e        end-of-line

>(d)press ALT+W (where ALT = metakey)

  M-w        kill-ring-save


There are other ways to do it too.

  M-x beginning-of-line
  M-x mark-end-of-line
  M-x kill-ring-save

The mark-end-of-line function is probably not bound to a key
sequence.

>now the line is copied...
>
>and to paste the copied line...
>
>(e)press CTRL-Y

Just for fun... copy several things into the kill ring  from
different places in a buffer, then use C-y to yank back the
last one.  They try M-y to replace it with the previous one,
continue using M-y to eventually get to the first region that
was copied.

>Now I have recently needed to use emacs on a remote machine (running
>under linux).
>I ssh into the machine from my computer (running windows) using ssh
>from cygwin.
>I open up emacs on this remote machine.
>But the steps (a) to (e) above will not work, i cannot copy a line.
>
>Anyone have any ideas where im going wrong? Im sure its pretty
>trivial, ive searched the net but to no avail.

Probably the C-space key sequence is not available via a remote
connection.

The trick you need is to find *all* such oddities, and then come
up with init files which make your two different systems act the
same way.  (As easy as that may sound... it isn't.)

--
Floyd L. Davidson           <http://web.newsguy.com/floyd_davidson>
Ukpeagvik (Barrow, Alaska)                         floyd@barrow.com

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

* Re: Copy and Pasting in Emacs...
  2004-03-07 23:20 Copy and Pasting in Emacs Patrick
                   ` (2 preceding siblings ...)
  2004-03-08  4:36 ` Floyd L. Davidson
@ 2004-03-08 13:44 ` Stefan Monnier
  2004-03-08 14:00   ` Stein A. Stromme
  2004-03-08 18:58   ` Kevin Rodgers
  3 siblings, 2 replies; 7+ messages in thread
From: Stefan Monnier @ 2004-03-08 13:44 UTC (permalink / raw)


> To copy a line in emacs i 
> (a)put the cursor at the beginning of the line
> (b)press CTRL+SPACEBAR
> (c)put the cursor at the end of the line
> (d)press ALT+W (where ALT = metakey)
> (e)press CTRL-Y
[...]
> I open up Emacs on this remote machine.
> But the steps (a) to (e) above will not work, i cannot copy a line.

I strongly suspect that not all of steps a to e fail.
So if you tell us which step(s) fail(s), we might be able to help you
a little better.  My crystal ball tells me that maybe C-SPC is the culprit
because it is not always supported by terminal emulators.  Try C-@ instead.
Or maybe it's the M-w that doesn't work because Alt is not properly mapped
to Meta by the terminal emulator (it should be turned into an ESC char).

Tell us also how you "put the cursor at ..." and what is the value of $TERM.


        Stefan "who'd use C-k C-y to copy and then C-y to yank"

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

* Re: Copy and Pasting in Emacs...
  2004-03-08 13:44 ` Stefan Monnier
@ 2004-03-08 14:00   ` Stein A. Stromme
  2004-03-08 18:58   ` Kevin Rodgers
  1 sibling, 0 replies; 7+ messages in thread
From: Stein A. Stromme @ 2004-03-08 14:00 UTC (permalink / raw)


[Stefan Monnier on copying a line]

|        Stefan "who'd use C-k C-y to copy and then C-y to yank"

I have this in my .emacs, stolen from Xemacs but works in GNU Emacs
as well:

    ;;; Utility from xemacs/lisp/misc.el

    (defun copy-from-above-command (&optional arg)
      "Copy characters from previous nonblank line, starting just above point.
    Copy ARG characters, but not past the end of that line.
    If no argument given, copy the entire rest of the line.
    The characters copied are inserted in the buffer before point."
      (interactive "P")
      (let ((cc (current-column))
        n
        (string ""))
        (save-excursion
          (beginning-of-line)
          (backward-char 1)
          (skip-chars-backward "\ \t\n")
          (move-to-column cc)
          ;; Default is enough to copy the whole rest of the line.
          (setq n (if arg (prefix-numeric-value arg) (point-max)))
          ;; If current column winds up in middle of a tab,
          ;; copy appropriate number of "virtual" space chars.
          (if (< cc (current-column))
          (if (eq (char-before (point)) ?\t)
              (progn
            (setq string (make-string (min n (- (current-column) cc)) ?\ ))
            (setq n (- n (min n (- (current-column) cc)))))
            ;; In middle of ctl char => copy that whole char.
            (backward-char 1)))
          (setq string (concat string
                   (buffer-substring
                    (point)
                    (min (save-excursion (end-of-line) (point))
                     (+ n (point)))))))
        (insert string)))

    (define-key global-map [(insert)] 'copy-from-above-command)

So to copy a line I move point below the line and do C-o (if
necessary, to make space for the new line) and then [insert].
(Feel free to use a different keystroke if you actually need the
insert key for something else.)

Of course this is only useful if you really want the new copy to come
immediately after the original, but I find this often to be the case.

SA
-- 
Stein Arild Strømme            +47 55584825, +47 95801887
Universitetet i Bergen                  Fax: +47 55589672     
Matematisk institutt               www.mi.uib.no/stromme/         
Johs Brunsg 12, N-5008 BERGEN           stromme@mi.uib.no

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

* Re: Copy and Pasting in Emacs...
  2004-03-08 13:44 ` Stefan Monnier
  2004-03-08 14:00   ` Stein A. Stromme
@ 2004-03-08 18:58   ` Kevin Rodgers
  1 sibling, 0 replies; 7+ messages in thread
From: Kevin Rodgers @ 2004-03-08 18:58 UTC (permalink / raw)


Stefan Monnier wrote:

>         Stefan "who'd use C-k C-y to copy and then C-y to yank"

`C-k C-x u'


-- 
Kevin Rodgers

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

end of thread, other threads:[~2004-03-08 18:58 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-03-07 23:20 Copy and Pasting in Emacs Patrick
2004-03-08  0:34 ` Billy O'Connor
2004-03-08  2:42 ` Benjamin Rutt
2004-03-08  4:36 ` Floyd L. Davidson
2004-03-08 13:44 ` Stefan Monnier
2004-03-08 14:00   ` Stein A. Stromme
2004-03-08 18:58   ` Kevin Rodgers

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.