summary refs log tree commit diff stats
path: root/lisp
diff options
context:
space:
mode:
Diffstat (limited to 'lisp')
-rw-r--r--lisp/acdw-org.el37
1 files changed, 37 insertions, 0 deletions
diff --git a/lisp/acdw-org.el b/lisp/acdw-org.el index 05e6409..a1558a2 100644 --- a/lisp/acdw-org.el +++ b/lisp/acdw-org.el
@@ -471,6 +471,43 @@ probably abandon it at some point for a better solution (see:
471 (org-narrow-to-subtree)))) 471 (org-narrow-to-subtree))))
472 472
473 473
474;;; Hide everything but the current headline
475;; https://stackoverflow.com/questions/25161792/
476
477(defun acdw-org/show-next-heading-tidily ()
478 "Show next entry, keeping other entries closed."
479 (interactive)
480 (if (save-excursion (end-of-line) (outline-invisible-p))
481 (progn (org-show-entry) (outline-show-children))
482 (outline-next-heading)
483 (unless (and (bolp) (org-at-heading-p))
484 (org-up-heading-safe)
485 (outline-hide-subtree)
486 (error "Boundary reached"))
487 (org-overview)
488 (org-reveal t)
489 (org-show-entry)
490 (recenter-top-bottom)
491 (outline-show-children)
492 (recenter-top-bottom)))
493
494(defun acdw-org/show-previous-heading-tidily ()
495 "Show previous entry, keeping other entries closed."
496 (interactive)
497 (let ((pos (point)))
498 (outline-previous-heading)
499 (unless (and (< (point) pos) (bolp) (org-at-heading-p))
500 (goto-char pos)
501 (outline-hide-subtree)
502 (error "Boundary reached"))
503 (org-overview)
504 (org-reveal t)
505 (org-show-entry)
506 (recenter-top-bottom)
507 (outline-show-children)
508 (recenter-top-bottom)))
509
510
474(provide 'acdw-org) 511(provide 'acdw-org)
475;;; acdw-org.el ends here 512;;; acdw-org.el ends here
476 513