emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [O] Insert TODO Item at Bottom


From: Max Mikhanosha
Subject: Re: [O] Insert TODO Item at Bottom
Date: Sun, 21 Oct 2012 14:59:30 -0400
User-agent: Wanderlust/2.15.9 (Almost Unreal) SEMI/1.14.6 (Maruoka) FLIM/1.14.9 (Gojō) APEL/10.6 Emacs/23.3.50 (x86_64-unknown-linux-gnu) MULE/6.0 (HANACHIRUSATO)

At Fri, 19 Oct 2012 01:31:24 +0200,
Esben Stien wrote:
> 
> I add a TODO item with M-S-RET, but is there any way to insert the new
> TODO item at the bottom of the current node or is there any way to
> navigate quickly to the last TODO item of the current node?.
> 
> I often run C-c a s to search, but I end up at the top and I always have
> to "scroll" down to the last TODO item; this is wasting my life

This is what I use, the commands insert the new todo at the beginning
of the current subtree, and in the end..

For example if you are currently editing the org document shown below,
and are at the "point before" position, then corresponding commands
will add the two items at the top and the bottom.. Get rid of viper
part if you not using viper.

* Project
** TODO <point after>
** TODO Some item
   some text <point before>
** TODO Another item
** TODO <point after>

(defun my-org-end-of-parent ()
  "Go to the end of the parent of the current headline, return parent headline 
level"
  (org-back-to-heading t)
  (org-up-heading-safe)
  (let ((level (org-outline-level)))
    (org-end-of-subtree t t)
    (or (bolp) (insert "\n"))
    (org-back-over-empty-lines)
    (org-reveal nil)
    level))

(defun my-org-insert-todo-heading-end (arg)
  "Insert TODO heading at the end of the current project"
  (interactive "p")
  (let ((parent-level (my-org-end-of-parent)))
    (when parent-level
      (end-of-line 0)
      (org-reveal nil)
      (org-insert-todo-heading-respect-content)
      (viper-change-state-to-insert))))

(defun my-org-insert-todo-heading-start (arg)
  "Insert TODO heading at the end of the current project"
  (interactive "p")
  (org-back-to-heading t)
  (org-up-heading-safe)
  (outline-next-heading)
  (beginning-of-line)
  (org-reveal)
  (org-insert-todo-heading-respect-content)
  (viper-change-state-to-insert))





reply via email to

[Prev in Thread] Current Thread [Next in Thread]