Peter Jones <mli...@pmade.com> 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



_______________________________________________
Emacs-orgmode mailing list
Remember: use `Reply All' to send replies to the list.
Emacs-orgmode@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode

Reply via email to