Procházet zdrojové kódy

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.
Marco Wahl před 5 roky
rodič
revize
7069dc3f32
2 změnil soubory, kde provedl 21 přidání a 0 odebrání
  1. 5 0
      etc/ORG-NEWS
  2. 16 0
      lisp/org.el

+ 5 - 0
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~
 *** ~org-agenda-ctrl-c-ctrl-c~
 
 
 =<C-c C-c>= in agenda calls ~org-agenda-set-tags~.
 =<C-c C-c>= in agenda calls ~org-agenda-set-tags~.
+
+*** ~org-hide-entry~
+
+Counterpart of ~org-show-entry~.
+
 ** New options
 ** New options
 *** New option ~org-clock-auto-clockout-timer~
 *** New option ~org-clock-auto-clockout-timer~
 
 

+ 16 - 0
lisp/org.el

@@ -5982,6 +5982,22 @@ Show the heading too, if it is currently invisible."
      'outline)
      'outline)
     (org-cycle-hide-drawers 'children)))
     (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)
 (defun org-show-children (&optional level)
   "Show all direct subheadings of this heading.
   "Show all direct subheadings of this heading.
 Prefix arg LEVEL is how many levels below the current level
 Prefix arg LEVEL is how many levels below the current level