GNU bug report logs - #69066
[PATCH] Fix compilation filtration if carriage is moved

Previous Next

Package: emacs;

Reported by: Evgeny Gagauz <evgenij.gagauz <at> gmail.com>

Date: Mon, 12 Feb 2024 05:35:13 UTC

Severity: normal

Tags: patch

Merged with 69067

To reply to this bug, email your comments to 69066 AT debbugs.gnu.org.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#69066; Package emacs. (Mon, 12 Feb 2024 05:35:14 GMT) Full text and rfc822 format available.

Acknowledgement sent to Evgeny Gagauz <evgenij.gagauz <at> gmail.com>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Mon, 12 Feb 2024 05:35:14 GMT) Full text and rfc822 format available.

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

From: Evgeny Gagauz <evgenij.gagauz <at> gmail.com>
To: bug-gnu-emacs <at> gnu.org
Cc: Evgeny Gagauz <evgenij.gagauz <at> gmail.com>
Subject: [PATCH] Fix compilation filtration if carriage is moved
Date: Mon, 12 Feb 2024 01:30:41 +0100
* 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.
---
 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)





Merged 69066 69067. Request was from Eli Zaretskii <eliz <at> gnu.org> to control <at> debbugs.gnu.org. (Mon, 12 Feb 2024 14:45:03 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#69066; Package emacs. (Mon, 19 Feb 2024 06:00:02 GMT) Full text and rfc822 format available.

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

From: Stefan Kangas <stefankangas <at> gmail.com>
To: Evgeny Gagauz <evgenij.gagauz <at> gmail.com>, 69066 <at> debbugs.gnu.org
Subject: Re: bug#69066: [PATCH] Fix compilation filtration if carriage is moved
Date: Mon, 19 Feb 2024 00:58:05 -0500
Evgeny Gagauz <evgenij.gagauz <at> gmail.com> 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)




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#69066; Package emacs. (Thu, 22 Feb 2024 08:35:02 GMT) Full text and rfc822 format available.

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

From: Gagauz Evgenij Vladimirovich <evgenij.gagauz <at> gmail.com>
To: 69066 <at> debbugs.gnu.org
Subject: Re: bug#69066: [PATCH] Fix compilation filtration if carriage is moved
Date: Thu, 22 Feb 2024 09:33:15 +0100
[Message part 1 (text/plain, inline)]
I could reproduce it with the following simple bash script:

printf '\r\e[K0'
sleep 1
printf '\r\e[K1'
sleep 1
printf '\r\e[K2'
sleep 1
printf '\r\e[K3'
sleep 1
printf '\r\e[K4'

The result is:
./test.sh
^[[K4
Compilation finished at Thu Feb 22 01:10:34

Interesting enough that the issue is not reproduced without sleeps. It
seems that the stream must be flushed to reproduce the issue.
[Message part 2 (text/html, inline)]

This bug report was last modified 1 year and 120 days ago.

Previous Next


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