emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* turn headline(s) into plain list?
@ 2011-05-06 18:39 Gary Oberbrunner
  2011-05-06 18:55 ` Bernt Hansen
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Gary Oberbrunner @ 2011-05-06 18:39 UTC (permalink / raw)
  To: Orgmode Mailing List

Is there any way to turn a headline (and its subtree) into a plain
list (and nested list items)?  Or better yet, turn all level N and
below headlines into plain lists at the corresponding level?

-- 
-- Gary

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

* Re: turn headline(s) into plain list?
  2011-05-06 18:39 turn headline(s) into plain list? Gary Oberbrunner
@ 2011-05-06 18:55 ` Bernt Hansen
  2011-05-06 18:57 ` Juan Pechiar
  2011-05-07 14:17 ` Matt Lundin
  2 siblings, 0 replies; 6+ messages in thread
From: Bernt Hansen @ 2011-05-06 18:55 UTC (permalink / raw)
  To: Gary Oberbrunner; +Cc: Orgmode Mailing List

Gary Oberbrunner <garyo@oberbrunner.com> writes:

> Is there any way to turn a headline (and its subtree) into a plain
> list (and nested list items)?  Or better yet, turn all level N and
> below headlines into plain lists at the corresponding level?

Hi Gary,

Just select the subtree of headings you want to convert and hit C-c -

In the example below I select lines 2-17 (Subheading 1 to the line
before All done)

--8<---------------cut here---------------start------------->8---
* Lists
** This is a heading
*** Subheading 1
*** Subheading 2
[2011-05-06 Fri 14:50]
*** Subheading3
[2011-05-06 Fri 14:51]
**** Three.1
[2011-05-06 Fri 14:51]
**** Three.2
[2011-05-06 Fri 14:51]
*** Four
[2011-05-06 Fri 14:51]
**** Five
[2011-05-06 Fri 14:51]
***** Six
[2011-05-06 Fri 14:51]
* All done
[2011-05-06 Fri 14:51]
--8<---------------cut here---------------end--------------->8---

and then C-c - gives me this:

--8<---------------cut here---------------start------------->8---
* Lists
** This is a heading
    - Subheading 1
    - Subheading 2
      [2011-05-06 Fri 14:50]
    - Subheading3
      [2011-05-06 Fri 14:51]
      - Three.1
        [2011-05-06 Fri 14:51]
      - Three.2
        [2011-05-06 Fri 14:51]
    - Four
      [2011-05-06 Fri 14:51]
      - Five
        [2011-05-06 Fri 14:51]
        - Six
          [2011-05-06 Fri 14:51]
* All done
[2011-05-06 Fri 14:51]
--8<---------------cut here---------------end--------------->8---

Regards,
Bernt

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

* Re: turn headline(s) into plain list?
  2011-05-06 18:39 turn headline(s) into plain list? Gary Oberbrunner
  2011-05-06 18:55 ` Bernt Hansen
@ 2011-05-06 18:57 ` Juan Pechiar
  2011-05-06 19:14   ` Bernt Hansen
  2011-05-07 14:17 ` Matt Lundin
  2 siblings, 1 reply; 6+ messages in thread
From: Juan Pechiar @ 2011-05-06 18:57 UTC (permalink / raw)
  To: Gary Oberbrunner; +Cc: Orgmode Mailing List

Hi,

'C-c -' may help to some extent:

  Cycle the entire list level through the different itemize/enumerate
  bullets (‘-’, ‘+’, ‘*’, ‘1.’, ‘1)’) or a subset of them, depending on
  org-plain-list-ordered- item-terminator, the type of list, and its
  position17. With a numeric prefix argument N, select the Nth bullet
  from this list. If there is an active region when calling this,
  selected text will be changed into an item. With a prefix argument,
  all lines will be converted to list items. If the first line already
  was a list item, any item marker will be removed from the list.
  Finally, even without an active region, a normal line will be
  converted into a list item.

It will convert headings into nested list items, but not the other
way.

Regards,
.j.

On Fri, May 06, 2011 at 02:39:27PM -0400, Gary Oberbrunner wrote:
> Is there any way to turn a headline (and its subtree) into a plain
> list (and nested list items)?  Or better yet, turn all level N and
> below headlines into plain lists at the corresponding level?
>

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

* Re: turn headline(s) into plain list?
  2011-05-06 18:57 ` Juan Pechiar
@ 2011-05-06 19:14   ` Bernt Hansen
  0 siblings, 0 replies; 6+ messages in thread
From: Bernt Hansen @ 2011-05-06 19:14 UTC (permalink / raw)
  To: Juan Pechiar; +Cc: Orgmode Mailing List, Gary Oberbrunner

Juan Pechiar <juan@pechiar.com> writes:

> Hi,
>
> 'C-c -' may help to some extent:
>
>   Cycle the entire list level through the different itemize/enumerate
>   bullets (‘-’, ‘+’, ‘*’, ‘1.’, ‘1)’) or a subset of them, depending on
>   org-plain-list-ordered- item-terminator, the type of list, and its
>   position17. With a numeric prefix argument N, select the Nth bullet
>   from this list. If there is an active region when calling this,
>   selected text will be changed into an item. With a prefix argument,
>   all lines will be converted to list items. If the first line already
>   was a list item, any item marker will be removed from the list.
>   Finally, even without an active region, a normal line will be
>   converted into a list item.
>
> It will convert headings into nested list items, but not the other
> way.

C-c * converts the other way.

-Bernt

>
> Regards,
> .j.
>
> On Fri, May 06, 2011 at 02:39:27PM -0400, Gary Oberbrunner wrote:
>> Is there any way to turn a headline (and its subtree) into a plain
>> list (and nested list items)?  Or better yet, turn all level N and
>> below headlines into plain lists at the corresponding level?
>>

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

* Re: turn headline(s) into plain list?
  2011-05-06 18:39 turn headline(s) into plain list? Gary Oberbrunner
  2011-05-06 18:55 ` Bernt Hansen
  2011-05-06 18:57 ` Juan Pechiar
@ 2011-05-07 14:17 ` Matt Lundin
  2011-05-07 14:20   ` Matt Lundin
  2 siblings, 1 reply; 6+ messages in thread
From: Matt Lundin @ 2011-05-07 14:17 UTC (permalink / raw)
  To: Gary Oberbrunner; +Cc: Orgmode Mailing List

Gary Oberbrunner <garyo@oberbrunner.com> writes:

> Is there any way to turn a headline (and its subtree) into a plain
> list (and nested list items)?  Or better yet, turn all level N and
> below headlines into plain lists at the corresponding level?

For the latter, you could use org-map-entries:

--8<---------------cut here---------------start------------->8---
(defun org-convert-low-levels-to-list (level)
  "Convert headings in file equal or greater than LEVEL to lists.
A numeric prefix argument can be used to set the level. The
default level is three"
  (interactive "P")
  (let ((level (number-to-string (or level 3))))
    (org-map-entries 'org-ctrl-c-minus
		     (concat "+LEVEL>=" level) 'file)))
--8<---------------cut here---------------end--------------->8---

There is also an FAQ that covers what the other replies have said.

http://orgmode.org/worg/org-faq.html#convert-plain-lists-to-headlines

Best,
Matt

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

* Re: turn headline(s) into plain list?
  2011-05-07 14:17 ` Matt Lundin
@ 2011-05-07 14:20   ` Matt Lundin
  0 siblings, 0 replies; 6+ messages in thread
From: Matt Lundin @ 2011-05-07 14:20 UTC (permalink / raw)
  To: Gary Oberbrunner; +Cc: Orgmode Mailing List

Matt Lundin <mdl@imapmail.org> writes:

> Gary Oberbrunner <garyo@oberbrunner.com> writes:
>
>> Is there any way to turn a headline (and its subtree) into a plain
>> list (and nested list items)?  Or better yet, turn all level N and
>> below headlines into plain lists at the corresponding level?
>
> For the latter, you could use org-map-entries:
>
> (defun org-convert-low-levels-to-list (level)
>   "Convert headings in file equal or greater than LEVEL to lists.
> A numeric prefix argument can be used to set the level. The
> default level is three"
>   (interactive "P")
>   (let ((level (number-to-string (or level 3))))
>     (org-map-entries 'org-ctrl-c-minus
> 		     (concat "+LEVEL>=" level) 'file)))
>

As an example, the function above converts the following:

--8<---------------cut here---------------start------------->8---
* One
** Two
*** Three
**** Four
***** Five
****** Six
******* Seven
****** Six
***** Five
**** Four
*** Three
** Two
* One
--8<---------------cut here---------------end--------------->8---

To this:

--8<---------------cut here---------------start------------->8---
* One
** Two
    - Three
      - Four
        - Five
          - Six
            - Seven
          - Six
        - Five
      - Four
    - Three
** Two
* One
--8<---------------cut here---------------end--------------->8---

Best,
Matt

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

end of thread, other threads:[~2011-05-07 14:20 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-05-06 18:39 turn headline(s) into plain list? Gary Oberbrunner
2011-05-06 18:55 ` Bernt Hansen
2011-05-06 18:57 ` Juan Pechiar
2011-05-06 19:14   ` Bernt Hansen
2011-05-07 14:17 ` Matt Lundin
2011-05-07 14:20   ` Matt Lundin

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