Benjamin McMillan <mcmilla...@gmail.com> writes: > When archiving a subtree to a different heading in the same buffer, all > headings are unfolded and the current narrowing is lost. This is easily > reproduced in a minimal instance of emacs by the following steps: > > 1. In an org file, create two headings "head" and "arch". Create a "child" > heading for "head". > 2. Add the archive property to "head" > :PROPERTIES: > #+ARCHIVE: ::* arch > :END: > 3. org-narrow-to-subtree on "head". > 4. org-archive-subtree on "child" > 5. (This demonstrates the loss of narrowing, you can also create additional > headings with folded content to see the loss of folding.)
Confirmed. This kind of intentional, but intentional in a sense that it was a (non-ideal) implementation detail of previous feature additions and bug fixes: https://cgit.git.savannah.gnu.org/cgit/emacs/org-mode.git/commit/?id=44e7ed1a59c8587c2d5c3a54917576f1505a6c7b https://cgit.git.savannah.gnu.org/cgit/emacs/org-mode.git/commit/?id=bf09955fec57307616926959b31e19af42520db0 > Both issues can be fixed by small modification to org-archive-subtree, by > wrapping the archiving edits in org-fold-core-save-visibility and > save-excursion blocks. > > I am happy to submit a patch. That would be welcome. -- 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>