Subject: Re: bug#77846: [PATCH ]31.0.50; C# dotnet compiler output incorrectly handled by compilation-mode

From: Jostein Kjønigsen <[email-masked]>
Date: Wed, 23 Apr 2025 08:29:36 +0200

> On 19 Apr 2025, at 21:28, Mattias Engdegård <[email-masked]> wrote:
> 
> 
>>> Perhaps it's compilation-filter-hook that really should be used to filter it out, and other sequences like it?
>> 
>> That also seems like an appropriate solution.
>> 
>> Is there precedence for solution like in place already?
> 
> This hook would be the most obvious thing to use if the stray sequence is emitted by a different layer and risks appearing in different contexts. For example, one could write something like
> 
>> (defun stray-msbuild-seq-compilation-filter ()
>>  (defvar compilation-filter-start)
>>  (let ((begin compilation-filter-start)
>>        (end (point))
>>        (inhibit-read-only t))
>>    (save-excursion
>>      (goto-char begin)
>>      (while (re-search-forward (rx bol "\e=") end t)
>>        (delete-region (match-beginning 0) (match-end 0))))))
> 
> and then add that function to compilation-filter-hook.
> 

Just to be clear and to make sure I understand: Do you suggest I test that hook locally and if it works, propose that as a patch? If so, should I add it to compile.el? Or were you suggesting something else?

I see that in the entirety of the current Emacs code-base, there are only 4 implemented hooks of this kind, and they are kinda spread around all over (follow.el, grep.el, so-long.el).

--
Jostein