GNU bug report logs - #58928
29.0.50; overlays in org-mode are disrupted after call `org-capture`

Previous Next

Package: emacs;

Reported by: Eli Qian <eli.q.qian <at> gmail.com>

Date: Mon, 31 Oct 2022 15:00:02 UTC

Severity: normal

Found in version 29.0.50

Full log


Message #65 received at 58928 <at> debbugs.gnu.org (full text, mbox):

From: Matt Armstrong <matt <at> rfc20.org>
To: Eason Huang <aqua0210 <at> foxmail.com>, Gerd Möllmann
 <gerd.moellmann <at> gmail.com>
Cc: Ihor Radchenko <yantar92 <at> posteo.net>, Eli Qian <eli.q.qian <at> gmail.com>,
 Eli Zaretskii <eliz <at> gnu.org>, 58928 <at> debbugs.gnu.org,
 Stefan Monnier <monnier <at> iro.umontreal.ca>
Subject: Re: bug#58928: 29.0.50; overlays in org-mode are disrupted after
 call `org-capture`
Date: Thu, 03 Nov 2022 15:51:28 -0700
Eason Huang <aqua0210 <at> foxmail.com> 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!

I think it is a different bug now visible after Stefan fixed the first
one.

It looks like `insert-before-markers' behaves differently for overlays
ending at `point'.  Indirect buffers are not required to reproduce it.
These tests now fail when they used to pass:

(ert-deftest test-overlay-insert-before-markers-empty ()
  (with-temp-buffer
    (insert "1234")
    (let ((overlay (make-overlay 2 2)))
      (goto-char 2)
      (insert-before-markers "x")
      (should (equal 3 (overlay-end overlay))))))

(ert-deftest test-overlay-insert-before-markers-non-empty ()
  (with-temp-buffer
    (insert "1234")
    (let ((overlay (make-overlay 2 3)))
      (goto-char 3)
      (insert-before-markers "x")
      (should (equal 4 (overlay-end overlay))))))

I am not sure that fixing this behavior difference will fix Eason's
repro steps, but it is worth fixing the above anyway.

Stefan, I won't have time to work on this until tomorrow.  If you have
the time I won't mind if you take a crack at a fix as you'll be about
100 times faster.  ;-)




This bug report was last modified 2 years and 226 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.