org-fold: Prevent folding level 1 headlines
* lisp/org-fold.el (org-fold--reveal-outline-maybe): Never keep level 1 headlines inserted inside folded region hidden. Such headlines can often be added to end of buffer by capture. This change prevents such headlines to be hidden. Reported in https://orgmode.org/list/CABUh-74vvn7i06T3zB=38_BFfBKS9J9H8NxGp_-eecoAPgygoQ@mail.gmail.com
This commit is contained in:
parent
4280762e4c
commit
2d6f26c057
|
@ -929,6 +929,11 @@ This function is intended to be used as :fragile property of
|
|||
(beginning-of-line)
|
||||
;; Make sure that headline is not partially hidden
|
||||
(unless (org-fold-folded-p nil 'headline) (org-fold-region (max (point-min) (1- (point))) (line-end-position) nil 'headline))
|
||||
;; Never hide level 1 headlines
|
||||
(save-excursion
|
||||
(goto-char (line-end-position))
|
||||
(when (re-search-forward (rx bol "* ") (cdr region) t)
|
||||
(org-fold-region (match-beginning 0) (line-end-position) nil 'headline)))
|
||||
;; Check the validity of headline
|
||||
(unless (let ((case-fold-search t))
|
||||
(looking-at (rx-to-string `(or (regex ,(org-item-re))
|
||||
|
|
Loading…
Reference in New Issue