[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/org 2d6f26c057 1/3: org-fold: Prevent folding level 1 h
From: |
ELPA Syncer |
Subject: |
[elpa] externals/org 2d6f26c057 1/3: org-fold: Prevent folding level 1 headlines |
Date: |
Wed, 27 Apr 2022 04:57:55 -0400 (EDT) |
branch: externals/org
commit 2d6f26c057fad23745dae17b80b53874a906858a
Author: Ihor Radchenko <yantar92@gmail.com>
Commit: Ihor Radchenko <yantar92@gmail.com>
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
---
lisp/org-fold.el | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/lisp/org-fold.el b/lisp/org-fold.el
index 0c978a377f..fb6c66bba5 100644
--- a/lisp/org-fold.el
+++ b/lisp/org-fold.el
@@ -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))