emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* copying headline structure without contents
@ 2009-04-23  9:47 Rainer Stengele
  2009-04-23 20:22 ` Mike Newman
  0 siblings, 1 reply; 3+ messages in thread
From: Rainer Stengele @ 2009-04-23  9:47 UTC (permalink / raw)
  To: emacs-orgmode

hi all,

is it possible to clone all visible or marked headlines without contents?

Example:


Having these lines:

* header1
  - contents
** header11
   - contents
* header2
  - contents
** header21
   - contents


I'd like to have


* header1
  - contents
** header11
   - contents
* header2
  - contents
** header21
   - contents
* header1
** header11
* header2
** header21


application:
having written a spec for a job I want to write another
one for a similar subject with headlines as before but changed contents


Thanks for any thought!

Rainer

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

* Re: copying headline structure without contents
  2009-04-23  9:47 copying headline structure without contents Rainer Stengele
@ 2009-04-23 20:22 ` Mike Newman
  2009-04-23 20:45   ` Bernt Hansen
  0 siblings, 1 reply; 3+ messages in thread
From: Mike Newman @ 2009-04-23 20:22 UTC (permalink / raw)
  To: emacs-orgmode

I think this is handled easily enough with existing org-mode + emacs
facilities

1) Mark the sub-tree (C-c @ is useful)
2) Copy and yank where you need it
3) Mark the new copy (or activate transient mark mode)
4) M-C-% (query-replace-regexp in region) to eliminate all the lines not starting with "*"

A suitable regexp should be "^[^*].*^J" where the ^J (linefeed) is entered by C-q C-j.

On Thu, 23 Apr 2009 11:47:02 +0200
Rainer Stengele <rainer.stengele@diplan.de> wrote:

> hi all,
> 
> is it possible to clone all visible or marked headlines without
> contents?
> 
> Example:
> 
> 
> Having these lines:
> 
> * header1
>   - contents
> ** header11
>    - contents
> * header2
>   - contents
> ** header21
>    - contents
> 
> 
> I'd like to have
> 
> 
> * header1
>   - contents
> ** header11
>    - contents
> * header2
>   - contents
> ** header21
>    - contents
> * header1
> ** header11
> * header2
> ** header21
> 
> 
> application:
> having written a spec for a job I want to write another
> one for a similar subject with headlines as before but changed
> contents
> 
> 
> Thanks for any thought!
> 
> Rainer
> 
> 
> 
> _______________________________________________
> Emacs-orgmode mailing list
> Remember: use `Reply All' to send replies to the list.
> Emacs-orgmode@gnu.org
> http://lists.gnu.org/mailman/listinfo/emacs-orgmode

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

* Re: copying headline structure without contents
  2009-04-23 20:22 ` Mike Newman
@ 2009-04-23 20:45   ` Bernt Hansen
  0 siblings, 0 replies; 3+ messages in thread
From: Bernt Hansen @ 2009-04-23 20:45 UTC (permalink / raw)
  To: Mike Newman; +Cc: emacs-orgmode

Or

S-TAB to fold the org-mode buffer to top level headlines only
Hit C-c C-k on the headlines to expand
Select the region you want to copy (in transient mode)

(the rest of this could be easily made into a function that works on the
selected region above)

M-x narrow-to-region
C-c C-e v SPC to export the visible stuff to another buffer
C-x h C-w to cut it all
C-x 0 to close the export window
M-x widen

Go to where you want to insert it and C-y or C-u C-y to paste

-Bernt


Mike Newman <mike@newmanfamily.me.uk> writes:

> I think this is handled easily enough with existing org-mode + emacs
> facilities
>
> 1) Mark the sub-tree (C-c @ is useful)
> 2) Copy and yank where you need it
> 3) Mark the new copy (or activate transient mark mode)
> 4) M-C-% (query-replace-regexp in region) to eliminate all the lines not starting with "*"
>
> A suitable regexp should be "^[^*].*^J" where the ^J (linefeed) is entered by C-q C-j.
>
> On Thu, 23 Apr 2009 11:47:02 +0200
> Rainer Stengele <rainer.stengele@diplan.de> wrote:
>
>> hi all,
>> 
>> is it possible to clone all visible or marked headlines without
>> contents?
>> 
>> Example:
>> 
>> 
>> Having these lines:
>> 
>> * header1
>>   - contents
>> ** header11
>>    - contents
>> * header2
>>   - contents
>> ** header21
>>    - contents
>> 
>> 
>> I'd like to have
>> 
>> 
>> * header1
>>   - contents
>> ** header11
>>    - contents
>> * header2
>>   - contents
>> ** header21
>>    - contents
>> * header1
>> ** header11
>> * header2
>> ** header21
>> 
>> 
>> application:
>> having written a spec for a job I want to write another
>> one for a similar subject with headlines as before but changed
>> contents
>> 
>> 
>> Thanks for any thought!
>> 
>> Rainer
>> 
>> 
>> 
>> _______________________________________________
>> Emacs-orgmode mailing list
>> Remember: use `Reply All' to send replies to the list.
>> Emacs-orgmode@gnu.org
>> http://lists.gnu.org/mailman/listinfo/emacs-orgmode
>
>
> _______________________________________________
> Emacs-orgmode mailing list
> Remember: use `Reply All' to send replies to the list.
> Emacs-orgmode@gnu.org
> http://lists.gnu.org/mailman/listinfo/emacs-orgmode

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

end of thread, other threads:[~2009-04-23 20:45 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-04-23  9:47 copying headline structure without contents Rainer Stengele
2009-04-23 20:22 ` Mike Newman
2009-04-23 20:45   ` Bernt Hansen

Code repositories for project(s) associated with this public inbox

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

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