Subject: bug#69066: [PATCH] Fix compilation filtration if carriage is moved

From: Stefan Kangas <[email-masked]>
Date: Mon, 19 Feb 2024 00:58:05 -0500

Evgeny Gagauz <[email-masked]> writes:

> * lisp/progmodes/compile.el (compilation-filter): If a process produces
> carriage cotrol characters then `compilation-filter-start' could point
> to a wrong place after applying `comint-carriage-motion'
> function. So its value is recalculated.

Thanks for the patch.

Could you provide more details about the issue you see?
Perhaps even a way to reproduce it?

> ---
>  lisp/progmodes/compile.el | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/lisp/progmodes/compile.el b/lisp/progmodes/compile.el
> index 11d400e145a..90ff414ad41 100644
> --- a/lisp/progmodes/compile.el
> +++ b/lisp/progmodes/compile.el
> @@ -2600,7 +2600,10 @@ and runs `compilation-filter-hook'."
>                (when compilation-hidden-output
>                  (compilation--hide-output compilation-filter-start))
>                (unless comint-inhibit-carriage-motion
> -                (comint-carriage-motion (process-mark proc) (point)))
> +                (comint-carriage-motion (process-mark proc) (point))
> +                ;; `compilation-filter-start' could be moved after
> +                ;; interpreting carriage control characters
> +                (setq compilation-filter-start (marker-position (process-mark proc))))
>                (set-marker (process-mark proc) (point))
>                ;; Update the number of errors in compilation-mode-line-errors
>                (compilation--ensure-parse (point))
> --
> 2.39.3 (Apple Git-145)