From: Peter Jones <mlists@pmade.com>
To: emacs-orgmode@gnu.org
Subject: Re: Jump to Heading Body, Create Plain List Item
Date: Sat, 21 Feb 2009 14:51:13 -0700 [thread overview]
Message-ID: <m2k57ja27i.fsf@pmade.com> (raw)
In-Reply-To: 86k57l2i05.fsf@pmade.com
Peter Jones <mlists@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
next prev parent reply other threads:[~2009-02-21 21:51 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-02-20 16:24 Jump to Heading Body, Create Plain List Item Peter Jones
2009-02-21 21:51 ` Peter Jones [this message]
2009-02-22 4:29 ` Peter Jones
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.orgmode.org/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=m2k57ja27i.fsf@pmade.com \
--to=mlists@pmade.com \
--cc=emacs-orgmode@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).