emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[BUG] org-fold-hide-entry hide the first subtree under a heading if the


From: k_foreign
Subject: [BUG] org-fold-hide-entry hide the first subtree under a heading if the heading has no content [9.5.5 (9.5.5-gcb1359 @ /home/user/meow-emacs/straight/build/org/)]
Date: Mon, 17 Oct 2022 13:33:10 +0800

Hello everyone, I found if you org-fold-hide-entry on a heading without
content but with subtrees, the first subtree will be folded, for
example (>|< meas cursor):

* H>|<EADING
** subheading1
** subheading2

if you press TAB on the above text, it will be:

* H>|<EADING
** subheading2

I changed a little of the code of org-fold-hide-entry (diff file enclosed), and 
it seems good 
to me now.

Emacs  : GNU Emacs 29.0.50 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.33, 
cairo version 1.17.6)
 of 2022-05-21
Package: Org mode version 9.5.5 (9.5.5-gcb1359 @ 
/home/user/meow-emacs/straight/build/org/)

===File ~/org-fold-hide-entry.diff==========================
diff --git a/lisp/org-fold.el b/lisp/org-fold.el
index 495f431cb..35b645a8c 100644
--- a/lisp/org-fold.el
+++ b/lisp/org-fold.el
@@ -319,10 +319,10 @@ When ENTRY is non-nil, show the entire entry."
   (interactive)
   (save-excursion
     (org-back-to-heading-or-point-min t)
-    (when (org-at-heading-p) (forward-line))
+    (when (org-at-heading-p) (end-of-line))
     (unless (eobp) ; Current headline is empty and ends at the end of buffer.
       (org-fold-region
-       (line-end-position 0)
+       (line-end-position)
        (save-excursion
          (if (re-search-forward
               (concat "[\r\n]" (org-get-limited-outline-regexp)) nil t)
============================================================



reply via email to

[Prev in Thread] Current Thread [Next in Thread]