From: Morgan Smith <morgan.j.smith@outlook.com>
To: Lars Ingebrigtsen <larsi@gnus.org>
Cc: Utkarsh Singh <utkarsh190601@gmail.com>, 45380@debbugs.gnu.org
Subject: bug#45380: 28.0.50; Error in coloured output in Emacs 28.05(AUR package: emacs-git)
Date: Sun, 24 Oct 2021 20:44:24 -0400 [thread overview]
Message-ID: <BYAPR05MB40230CACCD556CAA8461F96DC5839@BYAPR05MB4023.namprd05.prod.outlook.com> (raw)
In-Reply-To: <87y2ggoa22.fsf@gnus.org> (Lars Ingebrigtsen's message of "Tue, 26 Jan 2021 00:45:25 +0100")
Hey all,
I spent a good chunk of time debugging this but I'm pretty new to emacs devel so please let me know if I say anything funny.
How to reproduce: Just keep trying some long running colored commands in eshell like "git log --color". Eventually the logic will get messed up and it'll look like the previously posted screenshot. I've seen this bugs hundred of times from all sorts of different external commands. As long as the command has enough output it's not a question of "if" but "when" will the bug show.
I think the issue is in eshell-output-filter. Specifically I think the issue is with how it sets the eshell-last-output-start and eshell-last-input-end markers.
If we add some advice around our coloring function we can see that the coloring regions "overlap". I assume this overlap is because coloring the region is removing the control characters and making the region smaller. I don't think this is actually an issue, it's just something that smells like it could create bugs.
;; How to see the marker values
(defun where-are-markers (marker1 marker2)
(message "%s and %s" marker1 marker2))
(advice-add 'ansi-color-apply-on-region :before 'where-are-markers)
Thankfully, we can test out what would happen if we colored each bit of output as it comes in without worrying about regions. All we have to do is run this first:
(delete 'eshell-handle-ansi-color eshell-output-filter-functions)
(add-to-list 'eshell-preoutput-filter-functions 'ansi-color-apply)
And voila! Problem gone! Also I feel like this might run faster then the current method of filtering but I might be wrong about that.
So in conclusion: I found a workaround that might be more performant then the current coloring method but also doesn't actually fix the bug so we should probably dig deeper.
Morgan
next prev parent reply other threads:[~2021-10-25 0:44 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-12-23 4:09 bug#45380: 28.0.50; Error in coloured output in Emacs 28.05(AUR package: emacs-git) Utkarsh Singh
2020-12-23 15:39 ` Eli Zaretskii
2021-01-23 23:09 ` Lars Ingebrigtsen
[not found] ` <877do2n3ux.fsf@gmail.com>
2021-01-25 23:45 ` Lars Ingebrigtsen
2021-10-25 0:44 ` Morgan Smith [this message]
2021-10-25 0:48 ` Lars Ingebrigtsen
2021-10-25 0:55 ` Morgan Smith
2021-10-25 12:27 ` miha--- via Bug reports for GNU Emacs, the Swiss army knife of text editors
2021-10-25 13:25 ` Lars Ingebrigtsen
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=BYAPR05MB40230CACCD556CAA8461F96DC5839@BYAPR05MB4023.namprd05.prod.outlook.com \
--to=morgan.j.smith@outlook.com \
--cc=45380@debbugs.gnu.org \
--cc=larsi@gnus.org \
--cc=utkarsh190601@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).