unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: Nikos Apostolakis <nikos.ap@gmail.com>
Subject: Re: copy-word-from-line-above
Date: Thu, 18 Jan 2007 19:36:26 -0500	[thread overview]
Message-ID: <87ps9byhrp.fsf@gmail.com> (raw)
In-Reply-To: 51a4kbF1j2eebU1@mid.individual.net

Marc Tfardy <m-t-o@web.de> writes:

> HS wrote:
>> Hello!
>> Does anyone have a function that copies words from the line above, word
>> after word ?
>> I'd like this function so I could have something like this:
>>
>> double int xxx;
>>
>> Then I'd just put the cursor under that line, press <f2> (for example)
>> twice and would be in this state:
>>
>> double int xxx;
>> double int
>>
>> then I would continue adding the new variable.
>
> Not exactly what you looking for, but a simple macro do a similar job:
>

[...]

>
> This macro duplcates whole previous line. The point is on the
> end of the line. Now you can press (one or more times ) M-DEL
> and continue editing.

Here is a slightly better keyboard macro to record.  Go underneath
the line that you want to incrementally copy and do (spaces inseted
for readability)

C-x( C-e C-p C-M-s \< C-<space> C-M-s C-s M-w C-n C-y C-x)

IOW, go to the end of line, go to the line above, search for
beginning of word, set the mark, find the next beginning of word,
copy region, go to next line, yank.  Now hit C-xe to copy the word
above and (in emacs22 at least) keep hiting "e" to repeat as many
times as desired.  Haven't thoroughly checked it but it should work.

Shouldn't be hard to write this in lisp, either.

HTH
Nikos

  reply	other threads:[~2007-01-19  0:36 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-01-18 17:51 copy-word-from-line-above HS
2007-01-18 20:50 ` copy-word-from-line-above Marc Tfardy
2007-01-19  0:36   ` Nikos Apostolakis [this message]
2007-01-19 20:25 ` copy-word-from-line-above rgb
2007-01-21  5:36   ` copy-word-from-line-above Greg Bognar
2007-01-21 16:15     ` copy-word-from-line-above rgb
2007-01-22 13:02       ` copy-word-from-line-above HS
2007-01-24 12:19         ` copy-word-from-line-above rgb
2007-01-24 17:34           ` copy-word-from-line-above HS
2007-01-24 20:21             ` copy-word-from-line-above Markus Triska
2007-01-25 16:07               ` copy-word-from-line-above HS
2007-01-25 20:13                 ` copy-word-from-line-above Markus Triska
2007-01-25 16:16               ` copy-word-from-line-above rgb

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=87ps9byhrp.fsf@gmail.com \
    --to=nikos.ap@gmail.com \
    /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).