GNU bug report logs -
#45380
28.0.50; Error in coloured output in Emacs 28.05(AUR package: emacs-git)
Previous Next
Reported by: Utkarsh Singh <utkarsh190601 <at> gmail.com>
Date: Wed, 23 Dec 2020 07:15:02 UTC
Severity: normal
Tags: moreinfo
Found in version 28.0.50
Fixed in version 28.1
Done: Lars Ingebrigtsen <larsi <at> gnus.org>
Bug is archived. No further changes may be made.
Full log
Message #11 received at 45380 <at> debbugs.gnu.org (full text, mbox):
Utkarsh Singh <utkarsh190601 <at> gmail.com> writes:
> In the attached screenshot I am trying to compare eshell behaviour
> for 2 colored outputs. On the left hand side 'pacman -Ss emacs' command
> generates a small coloured output which works as expected but on the
> right hand side 'yay -Ss emacs' generates a fairly large output in which
> half of the colour in distorted. Screenshot have been obtained using
> 'emacs -Q' command.
I've seen similar bug reports about Emacs losing track of ANSI
highlighting -- especially when using programs like pacman, but I've so
far not been able to track down when/why this happens. My theory is
that the ansi-color-apply-on-region state machine somehow becomes
confused.
If this is repeatable to you, could you apply the following patch to
record the data, and then go to some buffer,
M-: (pp my-replay (current-buffer))
write the buffer to a file, gzip it, and then send it as an attachment
to this debbugs address?
diff --git a/lisp/ansi-color.el b/lisp/ansi-color.el
index e5bfccdb8b..e1fcd3d2ce 100644
--- a/lisp/ansi-color.el
+++ b/lisp/ansi-color.el
@@ -363,6 +363,8 @@ ansi-color-filter-region
(setq ansi-color-context-region (list nil (match-beginning 0)))
(setq ansi-color-context-region nil)))))
+(defvar my-replay nil)
+
(defun ansi-color-apply-on-region (begin end &optional preserve-sequences)
"Translates SGR control sequences into overlays or extents.
Delete all other control sequences without processing them.
@@ -384,6 +386,7 @@ ansi-color-apply-on-region
If PRESERVE-SEQUENCES is t, the sequences are hidden instead of
being deleted."
+ (push (buffer-substring begin end) my-replay)
(let ((codes (car ansi-color-context-region))
(start-marker (or (cadr ansi-color-context-region)
(copy-marker begin)))
--
(domestic pets only, the antidote for overdose, milk.)
bloggy blog: http://lars.ingebrigtsen.no
This bug report was last modified 3 years and 205 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.