From add2614cf95d7ab569c95521747ec80f5eca2225 Mon Sep 17 00:00:00 2001 From: Marco Wahl Date: Thu, 11 Jul 2019 12:08:47 +0200 Subject: [PATCH] Add function to flag region above first heading * lisp/org.el (org-flag-above-first-heading): New function. --- lisp/org.el | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/lisp/org.el b/lisp/org.el index 5d6cc757d..3326aa542 100644 --- a/lisp/org.el +++ b/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)