emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* [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/)]
@ 2022-10-17  5:33 k_foreign
  2022-10-17 13:07 ` Ihor Radchenko
  0 siblings, 1 reply; 2+ messages in thread
From: k_foreign @ 2022-10-17  5:33 UTC (permalink / raw)
  To: emacs-orgmode

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)
============================================================


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [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/)]
  2022-10-17  5:33 [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/)] k_foreign
@ 2022-10-17 13:07 ` Ihor Radchenko
  0 siblings, 0 replies; 2+ messages in thread
From: Ihor Radchenko @ 2022-10-17 13:07 UTC (permalink / raw)
  To: k_foreign; +Cc: emacs-orgmode

k_foreign@outlook.com writes:

> 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

Thanks for reporting!
Fixed on main.
https://git.savannah.gnu.org/cgit/emacs/org-mode.git/commit/?id=4b9aef20d8d7f2d2ce2457b7844effbf1223a35a

-- 
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-10-17 13:09 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-10-17  5:33 [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/)] k_foreign
2022-10-17 13:07 ` Ihor Radchenko

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).