17

Is there a function to convert between numbered and unordered lists in org-mode? The lists may or may not be nested.

24

You can use the function org-ctrl-c-minus, bound by default to (you guessed it) Control-c--, to cycle through the bullet types. The doctstring reads:

Insert separator line in table or modify bullet status of line. Also turns a plain line or a region of lines into list items. Calls org-table-insert-hline, org-toggle-item, or org-cycle-list-bullet, depending on context.

org-cycle-list-bullet, in turn, does the following according to the docstring:

(org-cycle-list-bullet &optional WHICH)

Cycle through the different itemize/enumerate bullets. This cycle the entire list level through the sequence:

- -> + -> * -> 1. -> 1)

If WHICH is a valid string, use that as the new bullet. If WHICH is an integer, 0 means -, 1 means + etc. If WHICH is previous, cycle backwards.

See the org manual node on plain lists for more details.

18

In my org-mode environment, for example, the first state is as followings: unordered list.

- a
- b
- c

Modify the first line as "1. a" as numbered list.

1. a
- b
- c

Now, hit C-c C-c at the first line "1. a". Unordered list becomes numbered list.

1. a
2. b
3. c

Modify the first line as "- a" as unordered list.

- a
2. b
3. c

Now Hit C-c C-c at the first line "- a". Numbered list becomes unordered list.

- a
- b
- c

I hope it works.

1
  • This is awesome! – lkahtz May 30 '20 at 2:52
1

You can use shift

(that is S-right in Emacs notation.) This is bound to org-shiftright, which will automatically do the right thing for your entire list if you're on any of the items. Press it multiple times to cycle through all possible list styles. And S-left goes the other way :)

(Source: reddit)

1
  • 1
    Both C-c - and S-<right> do the same thing: they both end up calling the function org-cycle-list-bullet. S-<left> calls org-cycle-list-bullet with an argument previous, something that cannot be done with C-c - (although that's not particularly inconvenient: the cycle is short). All of these are examples of context-dependent keybindings: they operate differently depending on the context. In particular, the description above applies when you use them on a list item. Consult the doc string of each function (e.g. C-h f org-shiftright) for details. – NickD Apr 9 at 15:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.