unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* Line Copy to Another Buffer
@ 2002-09-10 18:44 Artist
  2002-09-10 20:46 ` Kai Großjohann
  0 siblings, 1 reply; 6+ messages in thread
From: Artist @ 2002-09-10 18:44 UTC (permalink / raw)


Hi,
 I want to copy selective lines from one buffer to another buffer.
 So I browse one buffer and whenever I come across interesting line, I
just want to hit some command and copy to another buffer. I hae seen
the solution involving region, but that would be too much.

Thanks,
Seeking art of copying
Artist

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

* Re: Line Copy to Another Buffer
  2002-09-10 18:44 Line Copy to Another Buffer Artist
@ 2002-09-10 20:46 ` Kai Großjohann
  2002-09-11 17:56   ` Joe Casadonte
  2002-09-11 21:08   ` kgold
  0 siblings, 2 replies; 6+ messages in thread
From: Kai Großjohann @ 2002-09-10 20:46 UTC (permalink / raw)


googleartist@yahoo.com (Artist) writes:

>  I want to copy selective lines from one buffer to another buffer.
>  So I browse one buffer and whenever I come across interesting line, I
> just want to hit some command and copy to another buffer. I hae seen
> the solution involving region, but that would be too much.

Hm?  It's almost impossible to copy the line to another buffer
without using the region (or a region-like feature).

(defun art-copy-line ()
  (interactive)
  (append-to-buffer "COPY-BUFFER" (line-beginning-position)
                                  (line-end-position)))

kai
-- 
A large number of young women don't trust men with beards.  (BFBS Radio)

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

* Re: Line Copy to Another Buffer
  2002-09-10 20:46 ` Kai Großjohann
@ 2002-09-11 17:56   ` Joe Casadonte
  2002-09-11 23:23     ` Kevin Rodgers
  2002-09-11 21:08   ` kgold
  1 sibling, 1 reply; 6+ messages in thread
From: Joe Casadonte @ 2002-09-11 17:56 UTC (permalink / raw)


On Tue, 10 Sep 2002, Kai Großjohann wrote:

> Hm?  It's almost impossible to copy the line to another buffer
> without using the region (or a region-like feature).
>
> (defun art-copy-line ()
>   (interactive)
>   (append-to-buffer "COPY-BUFFER" (line-beginning-position)
>                                   (line-end-position)))

Through a save-excursion around that and you're set.

I have some crude code that does cut-copy-paste on the current region
or the current line, if there's no region (assumes transient-mark-mode
is on and mark-even-if-inactive is nil).  If anyone's interested, let
me know.

--
Regards,

joe
Joe Casadonte
jcasadonte@northbound-train.com

------------------------------------------------------------------------------
         Llama Fresh Farms => http://www.northbound-train.com
   Gay Media Resource List => http://www.northbound-train.com/gaymedia.html
            Perl for Win32 => http://www.northbound-train.com/perlwin32.html
               Emacs Stuff => http://www.northbound-train.com/emacs.html
          Music CD Trading => http://www.northbound-train.com/cdr.html
------------------------------------------------------------------------------
                       Live Free, that's the message!
------------------------------------------------------------------------------

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

* Re: Line Copy to Another Buffer
  2002-09-10 20:46 ` Kai Großjohann
  2002-09-11 17:56   ` Joe Casadonte
@ 2002-09-11 21:08   ` kgold
  1 sibling, 0 replies; 6+ messages in thread
From: kgold @ 2002-09-11 21:08 UTC (permalink / raw)



I use keyboard macros for this type of thing, since no elisp
programming knowledge is needed.  I have call-last-kbd-macro
on F2 since I use it so much.

For example, if the two buffers are in the frame, the keyboard macro
might be:

beginning-of-line
set-mark-command
end-of-line
copy-region-as-kill
other-window
yank
other-window

If you use it often, you can name and save the macro.

googleartist@yahoo.com (Artist) writes:

> I want to copy selective lines from one buffer to another buffer.
> So I browse one buffer and whenever I come across interesting line,
> I just want to hit some command and copy to another buffer. I have
> seen the solution involving region, but that would be too much.

-- 
-- 
Ken Goldman   kgold@watson.ibm.com   914-784-7646

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

* Re: Line Copy to Another Buffer
  2002-09-11 17:56   ` Joe Casadonte
@ 2002-09-11 23:23     ` Kevin Rodgers
  2002-09-12  2:04       ` Joe Casadonte
  0 siblings, 1 reply; 6+ messages in thread
From: Kevin Rodgers @ 2002-09-11 23:23 UTC (permalink / raw)


Joe Casadonte wrote:

> On Tue, 10 Sep 2002, Kai Großjohann wrote:
> 
> 
>>Hm?  It's almost impossible to copy the line to another buffer
>>without using the region (or a region-like feature).
>>
>>(defun art-copy-line ()
>>  (interactive)
>>  (append-to-buffer "COPY-BUFFER" (line-beginning-position)
>>                                  (line-end-position)))
>>
> 
> Through a save-excursion around that and you're set.


Why is that necessary?  The line-*-positions don't affect point, and
append-to-buffer doesn't select the COPY-BUFFER buffer.

-- 
Kevin Rodgers <kevinr@ihs.com>

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

* Re: Line Copy to Another Buffer
  2002-09-11 23:23     ` Kevin Rodgers
@ 2002-09-12  2:04       ` Joe Casadonte
  0 siblings, 0 replies; 6+ messages in thread
From: Joe Casadonte @ 2002-09-12  2:04 UTC (permalink / raw)


On Wed, 11 Sep 2002, Kevin Rodgers wrote:

>>>(defun art-copy-line ()
>>>  (interactive)
>>>  (append-to-buffer "COPY-BUFFER" (line-beginning-position)
>>>                                  (line-end-position)))
>>>
>> Through a save-excursion around that and you're set.
>
> Why is that necessary?  The line-*-positions don't affect point, and
> append-to-buffer doesn't select the COPY-BUFFER buffer.

Mea culpa.  You're right, of course.

--
Regards,

joe
Joe Casadonte
jcasadonte@northbound-train.com

------------------------------------------------------------------------------
         Llama Fresh Farms => http://www.northbound-train.com
   Gay Media Resource List => http://www.northbound-train.com/gaymedia.html
            Perl for Win32 => http://www.northbound-train.com/perlwin32.html
               Emacs Stuff => http://www.northbound-train.com/emacs.html
          Music CD Trading => http://www.northbound-train.com/cdr.html
------------------------------------------------------------------------------
                       Live Free, that's the message!
------------------------------------------------------------------------------

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

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

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2002-09-10 18:44 Line Copy to Another Buffer Artist
2002-09-10 20:46 ` Kai Großjohann
2002-09-11 17:56   ` Joe Casadonte
2002-09-11 23:23     ` Kevin Rodgers
2002-09-12  2:04       ` Joe Casadonte
2002-09-11 21:08   ` kgold

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).