Ignacio Casso <[email protected]> writes: >> Also, it would be nice to have a unit test since you've already put together >> an example. > > I wrote a test and check it failed without the fix but passes with > it. Here is the updated patch:
> From d02f2ee647fdf9a1c1c81500e3a99a5a5512a1bc Mon Sep 17 00:00:00 2001 > From: Ignacio Casso <[email protected]> > Date: Wed, 29 Apr 2026 10:28:01 +0200 > Subject: [PATCH] org.el: fix `org-sort-entries' bug when heading at point not > visible > > * lisp/org.el (org-sort-entries): Consider invisible text when moving > back to heading. Otherwise if the heading at point is not visible, the > function will not sort that heading but its closest visible parent. > > Link: https://list.orgmode.org/orgmode/[email protected] The bug you reported is a consequence of the function mostly designed for interactive use. If you use it interactively, it will be unexpected to sort invisible heading at point. Users will rather expect the nearest visible heading to be the subtree being sorted. I think that we condition your change depending on whether the function is called interactively or not. Also, there is similar inconsistency with active region. I expect bugs there. -- Ihor Radchenko // yantar92, Org mode maintainer, 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>
