GNU bug report logs - #70236
Truncating only happening on 900 character long lines in *compilation* buffer

Previous Next

Package: emacs;

Reported by: Dan Jacobson <jidanni <at> jidanni.org>

Date: Sat, 6 Apr 2024 09:15:01 UTC

Severity: normal

Done: Eli Zaretskii <eliz <at> gnu.org>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 70236 in the body.
You can then email your comments to 70236 AT debbugs.gnu.org in the normal way.

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#70236; Package emacs. (Sat, 06 Apr 2024 09:15:01 GMT) Full text and rfc822 format available.

Acknowledgement sent to Dan Jacobson <jidanni <at> jidanni.org>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Sat, 06 Apr 2024 09:15:02 GMT) Full text and rfc822 format available.

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

From: Dan Jacobson <jidanni <at> jidanni.org>
To: bug-gnu-emacs <at> gnu.org
Subject: Truncating only happening on 900 character long lines in
 *compilation* buffer
Date: Sat, 06 Apr 2024 17:14:14 +0800
In
https://emacs.stackexchange.com/questions/80941/what-truncates-lines-at-the-400th-character-in-the-compilation-buffer/80949
I have reproduced truncating triggered on 900 character lines only,
when one would expect it happening on other lines too.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#70236; Package emacs. (Sat, 06 Apr 2024 11:02:02 GMT) Full text and rfc822 format available.

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

From: Eli Zaretskii <eliz <at> gnu.org>
To: Dan Jacobson <jidanni <at> jidanni.org>
Cc: 70236 <at> debbugs.gnu.org
Subject: Re: bug#70236: Truncating only happening on 900 character long lines
 in *compilation* buffer
Date: Sat, 06 Apr 2024 14:01:15 +0300
> From: Dan Jacobson <jidanni <at> jidanni.org>
> Date: Sat, 06 Apr 2024 17:14:14 +0800
> 
> In
> https://emacs.stackexchange.com/questions/80941/what-truncates-lines-at-the-400th-character-in-the-compilation-buffer/80949
> I have reproduced truncating triggered on 900 character lines only,
> when one would expect it happening on other lines too.

When I try to reproduce, I get an error:

  make -k
  perl -MJSON -we 'for(1..9, q(A)..q(F)){$n=$_ x (hex ($_) * 100); @k=($n); print\
   length $n, " ", encode_json \@k, $/ x 2;}'
  Can't locate JSON.pm in @INC (you may need to install the JSON module) (@INC co\
  ntains: /etc/perl /usr/local/lib/x86_64-linux-gnu/perl/5.34.0 /usr/local/share/\
  perl/5.34.0 /usr/lib/x86_64-linux-gnu/perl5/5.34 /usr/share/perl5 /usr/lib/x86_\
  64-linux-gnu/perl-base /usr/lib/x86_64-linux-gnu/perl/5.34 /usr/share/perl/5.34\
   /usr/local/lib/site_perl).
  BEGIN failed--compilation aborted.
  make: *** [Makefile:2: k] Error 2

So please post a recipe which mere mortals can follow without the need
to go down the rabbit hole if installing Perl modules and whatnot.
Surely, investigating an Emacs issue shouldn't require any Perl modules.

I also don't understand what exactly is a bug here.  Is it the fact
that truncation happens at the 900th character, or is it about the
need of a nosy user to understand how the extra characters are hidden?




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#70236; Package emacs. (Sun, 07 Apr 2024 01:32:01 GMT) Full text and rfc822 format available.

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

From: Phil Sainty <psainty <at> orcon.net.nz>
To: 70236 <at> debbugs.gnu.org
Subject: Re: bug#70236: Truncating only happening on 900 character long
 lines in *compilation* buffer
Date: Sun, 07 Apr 2024 13:31:28 +1200
This will generate the same output as that perl:

(cl-loop for n from 100 to 1500 by 100 do
         (insert (number-to-string n)
                 " [\"" (make-string n (string-to-char
                                          (format "%X" (/ n 100))))
                 "\"]\n\n"))

If you write that to a file "test" in some temp dir and have
a Makefile like this:

foo:
	cat test

Then the suggested command will demonstrate the issue:

emacs -Q -f compile

What you're looking at is the difference between the "900" line
(which gets truncated) and all the other lines (which do not).

compilation-max-output-line-length is 400






Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#70236; Package emacs. (Sun, 07 Apr 2024 06:29:01 GMT) Full text and rfc822 format available.

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

From: Dan Jacobson <jidanni <at> jidanni.org>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 70236 <at> debbugs.gnu.org
Subject: Re: bug#70236: Truncating only happening on 900 character long lines
 in *compilation* buffer
Date: Sun, 7 Apr 2024 14:28:37 +0800
OK, sorry. I cleaned it up. Please give it another (two) runs. Thanks!

On Sat, Apr 06, 2024 at 02:01:15PM +0300, Eli Zaretskii wrote:
> > https://emacs.stackexchange.com/questions/80941/what-truncates-lines-at-the-400th-character-in-the-compilation-buffer/80949

> I also don't understand what exactly is a bug here.  Is it the fact
> that truncation happens at the 900th character, or is it about the
> need of a nosy user to understand how the extra characters are hidden?

You'll see that it doesn't happen on the shorter lines, or longer lines, but only on that line!




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#70236; Package emacs. (Sun, 07 Apr 2024 09:11:03 GMT) Full text and rfc822 format available.

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

From: Eli Zaretskii <eliz <at> gnu.org>
To: Phil Sainty <psainty <at> orcon.net.nz>
Cc: 70236 <at> debbugs.gnu.org
Subject: Re: bug#70236: Truncating only happening on 900 character long lines
 in *compilation* buffer
Date: Sun, 07 Apr 2024 12:10:22 +0300
> Date: Sun, 07 Apr 2024 13:31:28 +1200
> From: Phil Sainty <psainty <at> orcon.net.nz>
> 
> This will generate the same output as that perl:
> 
> (cl-loop for n from 100 to 1500 by 100 do
>           (insert (number-to-string n)
>                   " [\"" (make-string n (string-to-char
>                                            (format "%X" (/ n 100))))
>                   "\"]\n\n"))
> 
> If you write that to a file "test" in some temp dir and have
> a Makefile like this:
> 
> foo:
> 	cat test
> 
> Then the suggested command will demonstrate the issue:
> 
> emacs -Q -f compile
> 
> What you're looking at is the difference between the "900" line
> (which gets truncated) and all the other lines (which do not).
> 
> compilation-max-output-line-length is 400

Thanks, should be fixed now on the master branch.




Reply sent to Eli Zaretskii <eliz <at> gnu.org>:
You have taken responsibility. (Sat, 13 Apr 2024 09:08:02 GMT) Full text and rfc822 format available.

Notification sent to Dan Jacobson <jidanni <at> jidanni.org>:
bug acknowledged by developer. (Sat, 13 Apr 2024 09:08:02 GMT) Full text and rfc822 format available.

Message #22 received at 70236-done <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Dan Jacobson <jidanni <at> jidanni.org>
Cc: psainty <at> orcon.net.nz, 70236-done <at> debbugs.gnu.org
Subject: Re: bug#70236: Truncating only happening on 900 character long lines
 in *compilation* buffer
Date: Sat, 13 Apr 2024 12:06:46 +0300
> Cc: 70236 <at> debbugs.gnu.org
> Date: Sun, 07 Apr 2024 12:10:22 +0300
> From: Eli Zaretskii <eliz <at> gnu.org>
> 
> > Date: Sun, 07 Apr 2024 13:31:28 +1200
> > From: Phil Sainty <psainty <at> orcon.net.nz>
> > 
> > This will generate the same output as that perl:
> > 
> > (cl-loop for n from 100 to 1500 by 100 do
> >           (insert (number-to-string n)
> >                   " [\"" (make-string n (string-to-char
> >                                            (format "%X" (/ n 100))))
> >                   "\"]\n\n"))
> > 
> > If you write that to a file "test" in some temp dir and have
> > a Makefile like this:
> > 
> > foo:
> > 	cat test
> > 
> > Then the suggested command will demonstrate the issue:
> > 
> > emacs -Q -f compile
> > 
> > What you're looking at is the difference between the "900" line
> > (which gets truncated) and all the other lines (which do not).
> > 
> > compilation-max-output-line-length is 400
> 
> Thanks, should be fixed now on the master branch.

No further comments, so I presume the bug is indeed fixed, and I'm
therefore closing it.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#70236; Package emacs. (Sat, 13 Apr 2024 11:07:04 GMT) Full text and rfc822 format available.

Message #25 received at 70236-done <at> debbugs.gnu.org (full text, mbox):

From: Phil Sainty <psainty <at> orcon.net.nz>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 70236-done <at> debbugs.gnu.org, Dan Jacobson <jidanni <at> jidanni.org>
Subject: Re: bug#70236: Truncating only happening on 900 character long
 lines in *compilation* buffer
Date: Sat, 13 Apr 2024 23:06:32 +1200
On 2024-04-13 21:06, Eli Zaretskii wrote:
> No further comments, so I presume the bug is indeed fixed,
> and I'm therefore closing it.

Thanks Eli.  I presumed Dan would have tested, but I've just
given that a whirl and it looks like there's an off-by-one
bug in the fix.

Apart from the "900" line (which seems to remain special for
whatever reason the truncation was working there in the first
place), all the lines > 400 chars are getting two buttons:
one with the ellipsis, followed by a second button which is
"hiding" only the final character in the line (but also using
that character as the button text, so it's not "hidden", and
selecting that button just has the effect of that character
no longer looking like a button.

So in that test file the end of the lines looks like "[…]]"
but the two "]" chars are not related -- it's just that "]"
is the last character of each long line in that test file.

Selecting the […] button eliminates both buttons, but
selecting the "final character" button only eliminates that
button (as in both cases the button callback acts through to
the `line-end-position'.

I *think* commenting out this addition is the solution?
You'd already called `backward-char' earlier, so it looks
like this was doubling-up on that.

          (put-text-property
           start ;; (if ends-in-nl
                 ;;     ;; Don't hide the final newline.
                 ;;     (1- (point))
                   (point);; )
           'display (if (char-displayable-p ?…) "[…]" "[...]"))


-Phil





Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#70236; Package emacs. (Sat, 13 Apr 2024 12:05:02 GMT) Full text and rfc822 format available.

Message #28 received at 70236-done <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Phil Sainty <psainty <at> orcon.net.nz>
Cc: 70236-done <at> debbugs.gnu.org, jidanni <at> jidanni.org
Subject: Re: bug#70236: Truncating only happening on 900 character long
 lines in *compilation* buffer
Date: Sat, 13 Apr 2024 15:04:11 +0300
> Date: Sat, 13 Apr 2024 23:06:32 +1200
> From: Phil Sainty <psainty <at> orcon.net.nz>
> Cc: Dan Jacobson <jidanni <at> jidanni.org>, 70236-done <at> debbugs.gnu.org
> 
> On 2024-04-13 21:06, Eli Zaretskii wrote:
> > No further comments, so I presume the bug is indeed fixed,
> > and I'm therefore closing it.
> 
> Thanks Eli.  I presumed Dan would have tested, but I've just
> given that a whirl and it looks like there's an off-by-one
> bug in the fix.

Feel free to fix as you see fit, and thanks in advance.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#70236; Package emacs. (Sat, 13 Apr 2024 13:11:03 GMT) Full text and rfc822 format available.

Message #31 received at 70236-done <at> debbugs.gnu.org (full text, mbox):

From: Phil Sainty <psainty <at> orcon.net.nz>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 70236-done <at> debbugs.gnu.org, jidanni <at> jidanni.org
Subject: Re: bug#70236: Truncating only happening on 900 character long
 lines in *compilation* buffer
Date: Sun, 14 Apr 2024 01:09:58 +1200
On 2024-04-14 00:04, Eli Zaretskii wrote:
> Feel free to fix as you see fit, and thanks in advance.

I've pushed commit f950621e6a177fc3110f3dec7c92b7d499fd25d6 to
resolve that.  It's working correctly for the reported test case
so far as I can see.


-Phil





Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#70236; Package emacs. (Sat, 13 Apr 2024 14:32:03 GMT) Full text and rfc822 format available.

Message #34 received at 70236-done <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Phil Sainty <psainty <at> orcon.net.nz>
Cc: 70236-done <at> debbugs.gnu.org, jidanni <at> jidanni.org
Subject: Re: bug#70236: Truncating only happening on 900 character long
 lines in *compilation* buffer
Date: Sat, 13 Apr 2024 17:31:27 +0300
> Date: Sun, 14 Apr 2024 01:09:58 +1200
> From: Phil Sainty <psainty <at> orcon.net.nz>
> Cc: jidanni <at> jidanni.org, 70236-done <at> debbugs.gnu.org
> 
> On 2024-04-14 00:04, Eli Zaretskii wrote:
> > Feel free to fix as you see fit, and thanks in advance.
> 
> I've pushed commit f950621e6a177fc3110f3dec7c92b7d499fd25d6 to
> resolve that.  It's working correctly for the reported test case
> so far as I can see.

Thanks!




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#70236; Package emacs. (Sat, 13 Apr 2024 15:47:02 GMT) Full text and rfc822 format available.

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

From: Eli Zaretskii <eliz <at> gnu.org>
To: psainty <at> orcon.net.nz
Cc: 70236 <at> debbugs.gnu.org, jidanni <at> jidanni.org
Subject: Re: bug#70236: Truncating only happening on 900 character long lines
 in *compilation* buffer
Date: Sat, 13 Apr 2024 18:45:51 +0300
> Cc: 70236-done <at> debbugs.gnu.org, jidanni <at> jidanni.org
> Date: Sat, 13 Apr 2024 17:31:27 +0300
> From: Eli Zaretskii <eliz <at> gnu.org>
> 
> > Date: Sun, 14 Apr 2024 01:09:58 +1200
> > From: Phil Sainty <psainty <at> orcon.net.nz>
> > Cc: jidanni <at> jidanni.org, 70236-done <at> debbugs.gnu.org
> > 
> > On 2024-04-14 00:04, Eli Zaretskii wrote:
> > > Feel free to fix as you see fit, and thanks in advance.
> > 
> > I've pushed commit f950621e6a177fc3110f3dec7c92b7d499fd25d6 to
> > resolve that.  It's working correctly for the reported test case
> > so far as I can see.
> 
> Thanks!

Btw, wrt the issue of "magic 900 characters": I think it was just
sheer luck: the process filter got called when the process output did
not include the newline, and thus the bug was not triggered.  IOW,
this has something to do with buffering.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#70236; Package emacs. (Sat, 13 Apr 2024 23:09:04 GMT) Full text and rfc822 format available.

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

From: Dan Jacobson <jidanni <at> jidanni.org>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: psainty <at> orcon.net.nz, 70236 <at> debbugs.gnu.org
Subject: Re: bug#70236: Truncating only happening on 900 character long
 lines in *compilation* buffer
Date: Sun, 14 Apr 2024 07:08:34 +0800
[Message part 1 (text/html, inline)]

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Sun, 12 May 2024 11:24:07 GMT) Full text and rfc822 format available.

This bug report was last modified 4 days ago.

Previous Next


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