emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Converting lists to todo items and back
@ 2008-05-20 17:48 Bernt Hansen
  2008-05-20 18:04 ` Paul R
  2008-05-21 12:03 ` Carsten Dominik
  0 siblings, 2 replies; 5+ messages in thread
From: Bernt Hansen @ 2008-05-20 17:48 UTC (permalink / raw)
  To: emacs-orgmode

Hi Carsten and list!

I'm finding I outline new tasks quickly with lists like this

,----
| * New Task
|   - [ ] item 1
|   - [ ] item 2
|   - [ ] item 3
`----

and then I want to convert it to TODO items like this:

,----
| * New Task
| ** TODO item 1
| ** TODO item 2
| ** TODO item 3
`----

Is there a function to do that?  If there is any extra context after the
list it should just become part of the subheading (like this)

,----[ from this ]
| * New Task
|   - [ ] item 1
| 	detail goes here
| 	- more detail
| 	- blah
|   - [ ] item 2
| 	More detail here
| 	
| 	end of detail
|   - [ ] item 3	
`----

,----[ to this ]
| * New Task
| ** TODO item 1
|    detail goes here
|    - more detail
|    - blah
| ** TODO item 2
|    More detail here
| 	
|    end of detail
| ** TODO item 3	
`----

I don't really care about the indentation on conversion since normally
my lists have little or no detail other than the list item which I want
to turn into a TODO subheading

,----[ and back again ]
| * New Task
|   - [ ] item 1
| 	detail goes here
| 	- more detail
| 	- blah
|   - [ ] item 2
| 	More detail here
| 	
| 	end of detail
|   - [ ] item 3	
`----

Would something like that be useful?

The use case I had for this was I need to test some new functionality
I'm building and I created the list of things to test as the items were
identified.  This was a simple checkbox list.  Later when actually
testing I needed to add more detail (SQL output with test results) which
I wanted to archive to hide the gory details so I converted the
checkboxes to TODO subheadings and added the extra detail as testing
continued.

Regards,
Bernt

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

* Re: Converting lists to todo items and back
  2008-05-20 17:48 Converting lists to todo items and back Bernt Hansen
@ 2008-05-20 18:04 ` Paul R
  2008-05-21 12:03 ` Carsten Dominik
  1 sibling, 0 replies; 5+ messages in thread
From: Paul R @ 2008-05-20 18:04 UTC (permalink / raw)
  To: Bernt Hansen; +Cc: emacs-orgmode

Bernt Hansen <bernt@norang.ca> writes:

Hello Bernt,

> Hi Carsten and list!
>
> I'm finding I outline new tasks quickly with lists like this
>
> ,----
> | * New Task
> |   - [ ] item 1
> |   - [ ] item 2
> |   - [ ] item 3
> `----
>
> and then I want to convert it to TODO items like this:
>
> ,----
> | * New Task
> | ** TODO item 1
> | ** TODO item 2
> | ** TODO item 3
> `----

You can simply take advantage of emacs editing facilities.
See functions:
 - org-narrow-to-subtree
 - replace-regexp
 - widen

You can combine them in your own functions easily. See a brief tuto
about emacs lisp coding, or read the (excellent) emacs lisp
introduction.

-- 
      Paul

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

* Re: Converting lists to todo items and back
  2008-05-20 17:48 Converting lists to todo items and back Bernt Hansen
  2008-05-20 18:04 ` Paul R
@ 2008-05-21 12:03 ` Carsten Dominik
  2008-05-21 12:54   ` Bernt Hansen
  1 sibling, 1 reply; 5+ messages in thread
From: Carsten Dominik @ 2008-05-21 12:03 UTC (permalink / raw)
  To: Bernt Hansen; +Cc: emacs-orgmode

Hi Bernt,

this is a relative specializes application, for example you want the  
items to be turned into, not just outline headings, but also TODO  
entries.

Org has these:

C-c *      can turn an item into a headline.

However, the heading will always be a subheading of the nearest  
heading above,
so to convert your list, you should start from te end.


C-c -      can turn an headline into an item

`C-c -' will also take an active region and turn each line into an item.

My personal solution fo things like this usually is  keyboard macro.
For example, in this case

>
> ,----[ from this ]
> | * New Task
> |   - [ ] item 1
> | 	detail goes here
> | 	- more detail
> | 	- blah
> |   - [ ] item 2
> | 	More detail here
> | 	
> | 	end of detail
> |   - [ ] item 3	
> `----


I would position the cursor in "* New Task" line and then type:

C-x (            ; start keyboard macro
C-s ] RET        ; search forward to "]"
C-SPACE          ; set the mark
C-a              ; beginning of line
C-w              ; kill region
** TODO          ; Type new headline starter
C-x )            ; End kbd macro

And then type `C-x e' as often as necessary.
You can even do `C-u 200 C-x e' to get 200 repetitions in one go.

Once you have a feeling for how to write macros so that they will
safely do things, and safely position the cursor in the location
where you want it to start the next repetition, this is a really
efficient way of doing things.

If you keep doing the exact same conversion all the time,
yes, write a special command.

HTH

- Carsten

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

* Re: Converting lists to todo items and back
  2008-05-21 12:03 ` Carsten Dominik
@ 2008-05-21 12:54   ` Bernt Hansen
  2008-05-21 13:06     ` Carsten Dominik
  0 siblings, 1 reply; 5+ messages in thread
From: Bernt Hansen @ 2008-05-21 12:54 UTC (permalink / raw)
  To: Carsten Dominik, Paul R; +Cc: emacs-orgmode

Carsten Dominik <C.Dominik@uva.nl> writes:

> Org has these:
>
> C-c *      can turn an item into a headline.
>
> However, the heading will always be a subheading of the nearest
> heading above,
> so to convert your list, you should start from te end.
>
>
> C-c -      can turn an headline into an item
>
> `C-c -' will also take an active region and turn each line into an item.
>
> My personal solution fo things like this usually is  keyboard macro.
> For example, in this case

Thanks for the feedback :).  I wasn't aware of the C-c - and C-c * key
bindings.  I think I need to review the org-mode manual every quarter or
something - there's so much useful stuff in org-mode!

I ended up using a regexp replacement for converting my lists which
turned out to be pretty easy.

Sorry for the noise.

-Bernt

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

* Re: Converting lists to todo items and back
  2008-05-21 12:54   ` Bernt Hansen
@ 2008-05-21 13:06     ` Carsten Dominik
  0 siblings, 0 replies; 5+ messages in thread
From: Carsten Dominik @ 2008-05-21 13:06 UTC (permalink / raw)
  To: Bernt Hansen; +Cc: Paul R, emacs-orgmode


On May 21, 2008, at 2:54 PM, Bernt Hansen wrote:

> Carsten Dominik <C.Dominik@uva.nl> writes:
>
>> Org has these:
>>
>> C-c *      can turn an item into a headline.
>>
>> However, the heading will always be a subheading of the nearest
>> heading above,
>> so to convert your list, you should start from te end.
>>
>>
>> C-c -      can turn an headline into an item
>>
>> `C-c -' will also take an active region and turn each line into an  
>> item.
>>
>> My personal solution fo things like this usually is  keyboard macro.
>> For example, in this case
>
> Thanks for the feedback :).  I wasn't aware of the C-c - and C-c * key
> bindings.  I think I need to review the org-mode manual every  
> quarter or
> something - there's so much useful stuff in org-mode!
>
> I ended up using a regexp replacement for converting my lists which
> turned out to be pretty easy.

Yes, for people who can use regexps this is clearly a fast option.

- Carsten

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

end of thread, other threads:[~2008-05-21 13:25 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-05-20 17:48 Converting lists to todo items and back Bernt Hansen
2008-05-20 18:04 ` Paul R
2008-05-21 12:03 ` Carsten Dominik
2008-05-21 12:54   ` Bernt Hansen
2008-05-21 13:06     ` Carsten Dominik

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