emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: k_foreign@outlook.com
To: emacs-orgmode@gnu.org
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	[thread overview]
Message-ID: <BY5PR10MB4289036F2436A909412E9D5096299@BY5PR10MB4289.namprd10.prod.outlook.com> (raw)

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	other threads:[~2022-10-17  5:47 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-17  5:33 k_foreign [this message]
2022-10-17 13:07 ` [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/)] Ihor Radchenko

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=BY5PR10MB4289036F2436A909412E9D5096299@BY5PR10MB4289.namprd10.prod.outlook.com \
    --to=k_foreign@outlook.com \
    --cc=emacs-orgmode@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).