Benjamin Andresen <be...@in-ulm.de> writes:

> Hey Dan,
>
> Dan Davison <davi...@stats.ox.ac.uk> writes:
>
>>       (unless (org-heading-has-child-p) (org-cycle))
>
> There is no function by the name of org-heading-has-child-p in the
> current org-mode tree. I'd like to try the above code.

Thanks Benny.

Here's a new version. There could also be a reverse direction version if
people think this might be useful.

-----------------------------------------------------------
(defun ded/org-show-next-heading-tidily ()
  "Show next entry, keeping all other entries closed."
  (if (save-excursion (end-of-line) (outline-invisible-p))
      (org-cycle)
    (let ((pos (point))
          (level (org-current-level))
          (next-level
           (progn (outline-next-heading) (org-current-level))))
      (cond ((< next-level level)
             (save-excursion
               (outline-backward-same-level 1) (org-cycle)))
            ((= next-level level)
             (save-excursion (goto-char pos) (org-cycle))))
      (if (and (bolp) (org-on-heading-p))
          (org-cycle)
        (outline-up-heading 1 t)
        (org-cycle)
        (error "Boundary reached")))))

(setq org-use-speed-commands t)
(add-to-list 'org-speed-commands-user 
             '(" " ded/org-show-next-heading-tidily))
-----------------------------------------------------------

Dan

>
>>
>> Dan
>
> br,
> benny
>
>
> _______________________________________________
> Emacs-orgmode mailing list
> Remember: use `Reply All' to send replies to the list.
> Emacs-orgmode@gnu.org
> http://lists.gnu.org/mailman/listinfo/emacs-orgmode


_______________________________________________
Emacs-orgmode mailing list
Remember: use `Reply All' to send replies to the list.
Emacs-orgmode@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode

Reply via email to