Matt Armstrong writes: > Eason Huang writes: > >> I can reproduce the following steps, may be you can have try: >> >> 1. emacs -Q , launch Emacs >> 2. M-x org-capture, and then type `t` (task) >> Now the buffer CAPTURE-.notes will open with contents as bellow: >> >> ** TODO (now the cursor is here, you can type some characters, such as "test1", and then type C-C C-c ) >> [2022-11-03 Thu] >> >> 3. C-x b, switch-to-buffer .notes >> The contents is as below: >> * Tasks >> ** TODO test1(move cusror here and type TAB) >> [2022-11-03 Thu] >> >> 4. Now the .notes buffer is like this: >> * Tasks >> ** TODO test1... >> 5. Try step 2 again, now you will see the issue. Now the .notes buffer looks like this: >> * Tasks >> ** TODO test1...TODO >> [2022-11-03 Thu] >> test1 > > I can reproduce this too. Note that this is a new set of repro steps > that are easier to do after "emacs -Q". Thanks Eason! See attached fix to fix the bug found by Eason's steps quoted above. The bug was that we ignored the "before markers" part of `insert-before-markers'. Stefan, this and a couple other minor patches are in https://git.sr.ht/~matta/emacs/log/scratch/matta/for_stefan Now, with respect to Eason's repro above, Emacs is "bug/behavior compatible" with itself before the noverlay merge to master. There may still be an org-mode bug here. In step 3 above org puts an invisible overlay with "ellipsis" over the "TODO test1" heading and content. When it later appends the new heading via org-capture it does so with `insert-before-markers' which causes the end of the "ellipsis" overlay to cover the new entry too, which later confuses other org functions until the heading is expanded and the overlay is deleted. This seems wrong and doesn't happen in Emacs 27. But, it does happen as of commit 69121c33e4a11805bf6438131c8aec72411a0e5d (the predecessor to Stefan's noverlay->master merge commit).