Browse Source

Add function to flag region above first heading

* lisp/org.el (org-flag-above-first-heading): New function.
Marco Wahl 6 years ago
parent
commit
add2614cf9
1 changed files with 9 additions and 0 deletions
  1. 9 0
      lisp/org.el

+ 9 - 0
lisp/org.el

@@ -17908,6 +17908,15 @@ Use `\\[org-edit-special]' to edit table.el tables"))
     (org-reset-file-cache))
   (message "%s restarted" major-mode))
 
+(defun org-flag-above-first-heading (&optional arg)
+  "Hide from bob up to the first heading.
+Move point to the beginning of first heading or end of buffer."
+  (goto-char (point-min))
+  (unless (org-at-heading-p)
+    (outline-next-heading))
+  (unless (bobp)
+    (org-flag-region 1 (1- (point)) (not arg) 'outline)))
+
 (defun org-kill-note-or-show-branches ()
   "Abort storing current note, or call `outline-show-branches'."
   (interactive)