[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Orgmode] Re: Jump to Heading Body, Create Plain List Item
From: |
Peter Jones |
Subject: |
[Orgmode] Re: Jump to Heading Body, Create Plain List Item |
Date: |
Sat, 21 Feb 2009 14:51:13 -0700 |
User-agent: |
Gnus/5.110011 (No Gnus v0.11) Emacs/22.3 (darwin) |
Peter Jones <address@hidden> writes:
> I'd like a function that would do the following:
>
> 1) Move to the "body" of a heading (skipping drawers and the like)
>
> 2) Create the "body" if necessary (when there are no lines between
> sibling headings or between drawers and a sibling heading)
>
> 3) Append a new plain list item (or create a new plain list if there
This is what I've come up with so far. I have M-RET bound to the first
function, and M-S-RET bound to the second function.
(defun pmade:org-list-append (&optional checkbox)
"Append a plain list item to the current heading. If the
current heading already has plain list items, a new one will be
added, otherwise a new plain list will be created. If checkbox
is set, add a plain list item with a checkbox."
(interactive "P")
(when (not (org-insert-item (if checkbox 'checkbox)))
(org-back-to-heading)
(org-show-subtree)
(outline-next-heading)
(newline)
(when (bolp) (previous-line))
(org-indent-line-function)
(insert (concat "-" (if checkbox " [ ] " " ")))))
(defun pmade:org-list-append-with-checkbox ()
"Calls `pmade:org-list-append' with checkbox set."
(interactive)
(pmade:org-list-append t))
--
Peter Jones, http://pmade.com
pmade inc. Louisville, CO US