Subject: Re: bug#77732: grep-edit-buffer errors with incionsistent behaviour

From: Visuwesh <[email-masked]>
Date: Fri, 11 Apr 2025 21:42:51 +0530

[வெள்ளி ஏப்ரல் 11, 2025] Eli Zaretskii wrote:

>> From: Visuwesh <[email-masked]>
>> Cc: Johann Höchtl <[email-masked]>,
>>   [email-masked]
>> Date: Fri, 11 Apr 2025 18:01:27 +0530
>> 
>> I inserted a few message statements (see patch below), and I cannot
>> figure out where the sudden addition in the compilation-message is
>> coming from.
>
> Which addition is that?  I'm afraid you lost me here.

Oops, I butchered the statement: after the second time you type 'e', the
"Grep finished..." message attains a non-nil compilation-message
text-property.

> Can you explain which line of code causes the error, and why?

That's what I tried to figure out by adding the message statements but I
fail to understand how the compilation-message text-property is being
Added.  The relevant bits from *Messages* is at the end.

When I say 'e' for the first time then go back to grep-mode with C-c
C-c, there's no extra compilation-message text-property.

When I say 'e' for the second time around, till the end of
grep-change-to-grep-edit-mode, there's no extra compilation-message
text-property (lines marked with *).  But in the gap between
grep-change-to-grep-edit-mode and me saying C-c C-c (with no other
action being done by me in between), the extra compilation-message
text-property is added to the "Grep finished..." line.

    Grep finished with 17 matches found
    before prep 1 nil
    ----
    1666 nil
    1718 nil
    1769 nil
    1809 nil
    1847 nil
    1890 nil
    1932 nil
    1974 nil
    2024 nil
    2074 nil
    2149 nil
    2218 nil
    2269 nil
    2321 nil
    2378 nil
    2424 nil
    2471 nil [2 times]
    after prep 1 nil
    after undo 1 nil
    after hook 1 nil
    Editing: Type C-c C-c to return to Grep mode
    1 nil
    Switching to Grep mode
    1 nil
    before prep 1 nil
    ----
    1666 nil
    1718 nil
    1769 nil
    1809 nil
    1847 nil
    1890 nil
    1932 nil
    1974 nil
    2024 nil
    2074 nil
    2149 nil
    2218 nil
    2269 nil
    2321 nil
    2378 nil
    2424 nil
    2471 nil [2 times]
*   after prep 1 nil
*   after undo 1 nil
*   after hook 1 nil
    Editing: Type C-c C-c to return to Grep mode
    1 #s(compilation--message (nil 33 (("Grep finished with 17 matches found at Fri Apr 11 21" nil) nil (33 #1)) nil nil) 2 nil nil)
    Switching to Grep mode
    1 #s(compilation--message (nil 33 (("Grep finished with 17 matches found at Fri Apr 11 21" nil) nil (33 #1)) nil nil) 2 nil nil)
    before prep 1 #s(compilation--message (nil 33 (("Grep finished with 17 matches found at Fri Apr 11 21" nil) nil (33 #1)) nil nil) 2 nil nil)
    ----
    1666 #s(compilation--message (nil 33 (("Grep finished with 17 matches found at Fri Apr 11 21" nil) nil (33 #1)) nil nil) 2 nil nil)
    1718 #s(compilation--message (nil 33 (("Grep finished with 17 matches found at Fri Apr 11 21" nil) nil (33 #1)) nil nil) 2 nil nil)
    1769 #s(compilation--message (nil 33 (("Grep finished with 17 matches found at Fri Apr 11 21" nil) nil (33 #1)) nil nil) 2 nil nil)
    1809 #s(compilation--message (nil 33 (("Grep finished with 17 matches found at Fri Apr 11 21" nil) nil (33 #1)) nil nil) 2 nil nil)
    1847 #s(compilation--message (nil 33 (("Grep finished with 17 matches found at Fri Apr 11 21" nil) nil (33 #1)) nil nil) 2 nil nil)
    1890 #s(compilation--message (nil 33 (("Grep finished with 17 matches found at Fri Apr 11 21" nil) nil (33 #1)) nil nil) 2 nil nil)
    1932 #s(compilation--message (nil 33 (("Grep finished with 17 matches found at Fri Apr 11 21" nil) nil (33 #1)) nil nil) 2 nil nil)
    1974 #s(compilation--message (nil 33 (("Grep finished with 17 matches found at Fri Apr 11 21" nil) nil (33 #1)) nil nil) 2 nil nil)
    2024 #s(compilation--message (nil 33 (("Grep finished with 17 matches found at Fri Apr 11 21" nil) nil (33 #1)) nil nil) 2 nil nil)
    2074 #s(compilation--message (nil 33 (("Grep finished with 17 matches found at Fri Apr 11 21" nil) nil (33 #1)) nil nil) 2 nil nil)
    2149 #s(compilation--message (nil 33 (("Grep finished with 17 matches found at Fri Apr 11 21" nil) nil (33 #1)) nil nil) 2 nil nil)
    2218 #s(compilation--message (nil 33 (("Grep finished with 17 matches found at Fri Apr 11 21" nil) nil (33 #1)) nil nil) 2 nil nil)
    2269 #s(compilation--message (nil 33 (("Grep finished with 17 matches found at Fri Apr 11 21" nil) nil (33 #1)) nil nil) 2 nil nil)
    2321 #s(compilation--message (nil 33 (("Grep finished with 17 matches found at Fri Apr 11 21" nil) nil (33 #1)) nil nil) 2 nil nil)
    2378 #s(compilation--message (nil 33 (("Grep finished with 17 matches found at Fri Apr 11 21" nil) nil (33 #1)) nil nil) 2 nil nil)
    2424 #s(compilation--message (nil 33 (("Grep finished with 17 matches found at Fri Apr 11 21" nil) nil (33 #1)) nil nil) 2 nil nil)
    2471 #s(compilation--message (nil 33 (("Grep finished with 17 matches found at Fri Apr 11 21" nil) nil (33 #1)) nil nil) 2 nil nil)
    2583 #s(compilation--message (nil 33 (("Grep finished with 17 matches found at Fri Apr 11 21" nil) nil (33 #1)) nil nil) 2 nil nil)
    Entering debugger...