Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I change a list of plain lines into headlines/TODO items?

Tags:

emacs

org-mode

If I paste in a block of text composed of separated lines, is there any way to convert each of those lines into either headlines or TODO list items? So:

item
item
item

becomes:

* item
* item
* item

without my having to type [Meta][Return] at the begging of each line?

like image 561
Dmitri Avatar asked Jul 11 '11 17:07

Dmitri


3 Answers

With a default org-mode configuration, select your lines up to and including the newline at the end of the last line, and do M-x org-toggle-heading. With a prefix argument, it tells org-mode how many levels in it should make the heading (C-u 4 M-x org-toggle-heading)

like image 129
jdd Avatar answered Nov 17 '22 13:11

jdd


For example with following command:

M-x query-replace-regex RET ^\(.*\)$ RET * \1 RET
like image 45
Alex Ott Avatar answered Nov 17 '22 13:11

Alex Ott


Select your three lines, and while your cursor is on the first column of the fourth line type C-xrt*SPACERET. This calls the string-rectangle to insert the string *[space] in the vertical selection delimited by the mark and the cursor (i.e., the first column). C-xrt is a very useful command when editing aligned text.

like image 2
adl Avatar answered Nov 17 '22 11:11

adl