Browse Source

org: Enable org-show-entry before first heading

* lisp/org.el (org-show-entry): Before first heading show the region
  up to the first heading. Remove the now useless ignore-errors.

This behavior allows to reveal invisible text before the first
heading.
Marco Wahl 5 years ago
parent
commit
8b92bcd827
1 changed files with 12 additions and 13 deletions
  1. 12 13
      lisp/org.el

+ 12 - 13
lisp/org.el

@@ -5966,22 +5966,21 @@ open and agenda-wise Org files."
 ;;;; Headlines visibility
 
 (defun org-show-entry ()
-  "Show the body directly following this heading.
+  "Show the body directly following its heading.
 Show the heading too, if it is currently invisible."
   (interactive)
   (save-excursion
-    (ignore-errors
-      (org-back-to-heading t)
-      (org-flag-region
-       (line-end-position 0)
-       (save-excursion
-	 (if (re-search-forward
-	      (concat "[\r\n]\\(" org-outline-regexp "\\)") nil t)
-	     (match-beginning 1)
-	   (point-max)))
-       nil
-       'outline)
-      (org-cycle-hide-drawers 'children))))
+    (org-back-to-heading-or-point-min t)
+    (org-flag-region
+     (line-end-position 0)
+     (save-excursion
+       (if (re-search-forward
+	    (concat "[\r\n]\\(" org-outline-regexp "\\)") nil t)
+	   (match-beginning 1)
+	 (point-max)))
+     nil
+     'outline)
+    (org-cycle-hide-drawers 'children)))
 
 (defun org-show-children (&optional level)
   "Show all direct subheadings of this heading.