To insert a new TODO in org-mode, I currently move my cursor to the end of the current line and use the M-S-<RET> shortcut. If I am within a subtree, I also have to go to the end of the last tree item.

I was wondering if it is possible to create a shortcut which appends a new top-level TODO (i.e., a single *) below whatever subtree the cursor is in. Eliminating the cursor movements would be very helpful to me while brainstorming and quickly capturing thoughts.

  • Do you always want to insert a top level heading? It seems like that might break your hierarchy if you were more than two levels down. If not, outline-up-heading followed by org-insert-heading-after-current will work.
    – erikstokes
    Mar 2, 2015 at 23:03
  • Ah, I didn't know about org-insert-heading-after-current. Yes, that combined with outline-up-heading is probably the better route to go. org-insert-heading-after-current solves my needs a little better as it skips over sublevels within a tree as well. Mar 2, 2015 at 23:44

2 Answers 2


This function adds a new headline after the parent of the headline the cursor is on. With a prefix argument, it adds the heading arg levels up.

(defun org-insert-heading-after-parent (arg)
  (interactive "p")
    (outline-up-heading arg)
  • Thanks for the additional function, but in practice, I think I will likely just go with your original suggestion of using the 2 commands separately. Mar 3, 2015 at 0:09

Here's a simple function to do something similar.

(defun test ()
  (point-to-register 'p)
  (search-forward-regexp "^\\* ")
  (insert "*
  (register-to-point 'p))
  • Thanks. That function takes care of the cursor issue, but it seems to add a new item at the same tree level as wherever the cursor is, rather than at the top level. That is certainly useful, but is it possible to instead insert a new top-level item after the current tree? This is close enough though, and I may actually end up using this function instead. Mar 2, 2015 at 23:16
  • Should be simple to change, I wasn't entirely sure where you wanted it inserted. Just change outline-next-visible-heading to a command that moves beyond the current tree.
    – user2699
    Mar 3, 2015 at 0:18
  • It looks like there isn't quite that command, but org-mode is conveniently plain text, so (search-forward-regexp "^\\* ") seems to do the trick.
    – user2699
    Mar 3, 2015 at 0:27
  • @user2699 You might find save-excursion a easier to use way to save the point since it also saves the mark and the state of the region. Also, your progn seems unnecessary.
    – erikstokes
    Mar 3, 2015 at 3:41
  • @erikstokes thanks, I didn't realize that.
    – user2699
    Mar 6, 2015 at 1:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.