In large org trees, it would be useful to jump
- from a heading to the last (direct) subheading
- to the last or first heading on the same level
Are there functions in org-mode that accomplish this?
You don't need special functions for this:
from a heading to the last direct subheading, C-c C-n
will get you to the first direct subheading, and then C-u 10000 C-c C-f
will get you to the last one (I assume there are fewer than 10000 headings at this level - feel free to add one or more 0's if that's not enough).
C-u 10000 C-c C-b
similarly will take you to the first heading at this level and as described above C-u 10000 C-c c-f
will take you to the last one (both with the same caveat).
If you need to do this often, create keyboard macros
to do each, save them and bind them to keys. Do C-h i g(emacs)Keyboard macros
for more info.
BTW, you can do C-h c C-c C-b
to find out what command is bound to C-c C-b
and similarly for the others. Check the Motion
section of the manual with C-h i g(org)Motion
.
In addition to using keyboard macros, you can also write your own command. Here's one that moves the cursor to the last heading of the subtree, or to the first sibling when called with a prefix argument.
(defun org-tree-goto-last (arg)
(interactive "P")
(if arg (while (org-goto-sibling 'previous))
(org-up-heading-safe)
(org-end-of-subtree)
(re-search-backward org-complex-heading-regexp nil t)))