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

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

[ Please use Reply All in your mail client to ensure the entire
  conversation is recorded in the bug tracker.  ]

[வெள்ளி ஏப்ரல் 11, 2025] Johann Höchtl wrote:

> First thank you for the hint of toggle-debug-on-error, TIL
>
> The trace:
>
> Debugger entered--Lisp error: (wrong-type-argument stringp nil)
>   compilation-find-file-1(#<marker in no buffer> "Grep started at Fri Apr
> 11 12" nil nil)
>   compilation-find-file(#<marker in no buffer> "Grep started at Fri Apr 11
> 12" nil)
>   compilation--update-markers((nil 58 (("Grep started at Fri Apr 11 12"
> nil) nil (58 #1)) nil nil) #<marker in no buffer> nil 0)
>   grep-edit--prepare-buffer()
>   grep-change-to-grep-edit-mode()
>   funcall-interactively(grep-change-to-grep-edit-mode)
>   command-execute(grep-change-to-grep-edit-mode)
>
>
> The buffer starts the following:
>
> -*- mode: grep; default-directory: "~/OneDrive - Online/Dokumente/" -*-
> Grep started at Fri Apr 11 12:58:57
>

I can reproduce the issue with 17 hits but not with >200.  I will try
digging into this more.

> Am Fr., 11. Apr. 2025 um 12:37 Uhr schrieb Visuwesh <[email-masked]>:
>
>> [வெள்ளி ஏப்ரல் 11, 2025] Johann Höchtl wrote:
>>
>> > I am using Emacs from HEAD on Windows
>> >
>> > I tried to reproduce the behaviour with emacs -Q but it still remains
>> > inconsistent.
>> >
>> > When I rgrep and there are few results (< 15) , I can enter grep buffer
>> > pres 'e' to enter grep-edit mode, get out of it with C-c C-c, re-enter
>> with
>> > 'e' and so on.
>> >
>> > When there are more results, (between 15 and 70)  I still can enter with
>> > 'e' get out with C-c C-c but when I try to re-enter I get the error
>> message
>> > Wrong type argument: stringp, nil
>> > The buffer later although still in grp-mode does not behave any longer
>> as a
>> > grep mode, 'g' or 'e' results in the error Buffer is read only : #<buffer
>> > *grep*>
>> >
>> > When there are many results, I get the error message Wrong type argument:
>> > stringp, nil already on the first invocation attempt.
>> >
>> > Thew boundaries are somewhat moving but at least I have the feeling the
>> > more matches are, the more frequently I run into the
>> >
>> > Wrong type argument: stringp, nil
>> >
>> > already at first try.
>>
>> Can you please share the backtrace?  Say M-x toggle-debug-on-error RET
>> before trying to reproduce the error above.  I mostly tested
>> grep-edit-mode with M-x rgrep, and a good amount of results.
>>