Say we have a org buffer with content:
* top-level heading
some text $ # $ denote cursor
** heading 3
** heading 2
** heading 1
** heading 0
Now evaluate (save-excursion (org-sort-entries nil ?a))
. The cursor goes to the beginning of top-level heading
, rather than stays put at $
as I would expect.
Why does save-excursion
does not work under this situation?
Updated: Even with (save-excursion (save-restriction (org-sort-entries nil ?a)))
, the cursor still moves.