From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Nikos Apostolakis Newsgroups: gmane.emacs.help Subject: Re: copy-word-from-line-above Date: Thu, 18 Jan 2007 19:36:26 -0500 Message-ID: <87ps9byhrp.fsf@gmail.com> References: <1169142712.291197.26770@a75g2000cwd.googlegroups.com> <51a4kbF1j2eebU1@mid.individual.net> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1169167017 27896 80.91.229.12 (19 Jan 2007 00:36:57 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Fri, 19 Jan 2007 00:36:57 +0000 (UTC) Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Fri Jan 19 01:36:54 2007 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1H7hkT-0006Ht-Qa for geh-help-gnu-emacs@m.gmane.org; Fri, 19 Jan 2007 01:36:54 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1H7hkU-0006ya-HI for geh-help-gnu-emacs@m.gmane.org; Thu, 18 Jan 2007 19:36:54 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1H7hkH-0006ws-A0 for help-gnu-emacs@gnu.org; Thu, 18 Jan 2007 19:36:41 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1H7hkG-0006vl-Ox for help-gnu-emacs@gnu.org; Thu, 18 Jan 2007 19:36:41 -0500 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1H7hkG-0006ve-GX for help-gnu-emacs@gnu.org; Thu, 18 Jan 2007 19:36:40 -0500 Original-Received: from [80.91.229.2] (helo=ciao.gmane.org) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA:32) (Exim 4.52) id 1H7hkG-00050C-4F for help-gnu-emacs@gnu.org; Thu, 18 Jan 2007 19:36:40 -0500 Original-Received: from list by ciao.gmane.org with local (Exim 4.43) id 1H7hkE-0005Az-2L for help-gnu-emacs@gnu.org; Fri, 19 Jan 2007 01:36:38 +0100 Original-Received: from user-0cdf4ca.cable.mindspring.com ([24.215.145.138]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Fri, 19 Jan 2007 01:36:38 +0100 Original-Received: from nikos.ap by user-0cdf4ca.cable.mindspring.com with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Fri, 19 Jan 2007 01:36:38 +0100 X-Injected-Via-Gmane: http://gmane.org/ Original-To: help-gnu-emacs@gnu.org Original-Lines: 44 Original-X-Complaints-To: usenet@sea.gmane.org X-Gmane-NNTP-Posting-Host: user-0cdf4ca.cable.mindspring.com User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.92 (gnu/linux) Cancel-Lock: sha1:BODOERrGTkBJFKKwLIcaridexcI= X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:40445 Archived-At: Marc Tfardy 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 (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- 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