summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarco Wahl <marcowahlsoft@gmail.com>2020-07-21 12:14:10 +0200
committerMarco Wahl <marcowahlsoft@gmail.com>2020-07-21 12:14:10 +0200
commit7069dc3f32c35a0c2631f19c67d6ca3fde8ab00a (patch)
treeeec4fed0e7316418745ac87ff494c3a6964424f2
parentbb427f7bd685a9064053c4109c340307eb584daa (diff)
downloadorg-mode-7069dc3f32c35a0c2631f19c67d6ca3fde8ab00a.tar.gz
org: New function to hide the body up to the first child
* lisp/org.el (org-hide-entry): New function. Counterpart to org-show-entry.
-rw-r--r--etc/ORG-NEWS5
-rw-r--r--lisp/org.el16
2 files changed, 21 insertions, 0 deletions
diff --git a/etc/ORG-NEWS b/etc/ORG-NEWS
index bfe37b1..bc93f8e 100644
--- a/etc/ORG-NEWS
+++ b/etc/ORG-NEWS
@@ -280,6 +280,11 @@ possible via column view value edit or with =<C-c C-q>=.
*** ~org-agenda-ctrl-c-ctrl-c~
=<C-c C-c>= in agenda calls ~org-agenda-set-tags~.
+
+*** ~org-hide-entry~
+
+Counterpart of ~org-show-entry~.
+
** New options
*** New option ~org-clock-auto-clockout-timer~
diff --git a/lisp/org.el b/lisp/org.el
index 12a853b..5199c75 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -5982,6 +5982,22 @@ Show the heading too, if it is currently invisible."
'outline)
(org-cycle-hide-drawers 'children)))
+(defun org-hide-entry ()
+ "Hide the body directly following its heading."
+ (interactive)
+ (save-excursion
+ (org-back-to-heading-or-point-min t)
+ (when (org-at-heading-p) (forward-line))
+ (org-flag-region
+ (line-end-position 0)
+ (save-excursion
+ (if (re-search-forward
+ (concat "[\r\n]" org-outline-regexp) nil t)
+ (line-end-position 0)
+ (point-max)))
+ t
+ 'outline)))
+
(defun org-show-children (&optional level)
"Show all direct subheadings of this heading.
Prefix arg LEVEL is how many levels below the current level