* Jump to Heading Body, Create Plain List Item
@ 2009-02-20 16:24 Peter Jones
2009-02-21 21:51 ` Peter Jones
0 siblings, 1 reply; 3+ messages in thread
From: Peter Jones @ 2009-02-20 16:24 UTC (permalink / raw)
To: emacs-orgmode
I've been reading through the code, and I don't think this is possible
yet, but I wanted to double check before I wrote something.
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
wasn't one there already)
I find myself doing this many times during the day:
1) Create a new heading, and clock in
2) Move point past the clock drawer
3) Create a blank line under the drawer
4) Create a list item
It would be super cool if I could just hit a key on a heading, and it
would append a new plain list item and move point there. I would
probably bind M-RET to this function, since I use C-RET to create new
headings.
Does this exist? I'll write it otherwise.
--
Peter Jones, http://pmade.com
pmade inc. Louisville, CO US
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Jump to Heading Body, Create Plain List Item
2009-02-20 16:24 Jump to Heading Body, Create Plain List Item Peter Jones
@ 2009-02-21 21:51 ` Peter Jones
2009-02-22 4:29 ` Peter Jones
0 siblings, 1 reply; 3+ messages in thread
From: Peter Jones @ 2009-02-21 21:51 UTC (permalink / raw)
To: emacs-orgmode
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
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Jump to Heading Body, Create Plain List Item
2009-02-21 21:51 ` Peter Jones
@ 2009-02-22 4:29 ` Peter Jones
0 siblings, 0 replies; 3+ messages in thread
From: Peter Jones @ 2009-02-22 4:29 UTC (permalink / raw)
To: emacs-orgmode
Peter Jones <mlists@pmade.com> writes:
> 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.
Small bug fix:
(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)
(if (eolp) (newline)
(newline)
(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
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2009-02-22 4:29 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-02-20 16:24 Jump to Heading Body, Create Plain List Item Peter Jones
2009-02-21 21:51 ` Peter Jones
2009-02-22 4:29 ` Peter Jones
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).