What truncates lines at the 400th character?

I notice that when a line is longer that 400 characters, it gets truncated with "[...]" added at the end.

Yes, it is due to something I put in my .emacs file, as emacs -Q does not behave like that.

I looked in so-long.el and there was no "400".

I put the mouse upon the "[...]" and there was no hint about what was responsible for it.

Tinkering with so-long-threshold didn't help, so that's not what is doing it.

P.S., I also want to make 400 300.

Yes I know about M-x toggle-truncate-lines and it works great, but that's not what I'm talking about today.

  • 2
    Emacs being infinitely customizable, it's difficult for us to guess what you might have in your .emacs that's causing this problem. For general debugging, see: emacs.stackexchange.com/questions/28429/…
    – Tyler
    Commented Apr 4 at 16:03
  • Since this might be related to so-long, you could also check here: elpa.gnu.org/packages/so-long.html
    – Tyler
    Commented Apr 4 at 16:03
  • Bisect your init file. @Tyler's link from his first comment tells you how.
    – NickD
    Commented Apr 4 at 19:13
  • so-long doesn't truncate lines in any case. In which buffers/modes are you observing this? (I'm imagining it's mode-specific, but you haven't given any details.)
    – phils
    Commented Apr 5 at 0:53
  • Put the cursor at end of line, and share M-x describe-text-properties
    – mxnt
    Commented Apr 5 at 1:47

1 Answer 1


Edit: The truncation at 400 characters is due to the user option compilation-max-output-line-length, and the fact that this wasn't working for most of the lines in the example was due to a bug in the function compilation--insert-abbreviated-line which has been fixed for Emacs 30.

Holy moly.

$ cat /tmp/Makefile 
        perl -we 'for(1..9, q(A)..q(F)){$$n=$$_ x (hex ($$_) * 100); $(\
        )print length $$n, " ",  $$n, $$/ x 2;}'

$ emacs -Q -nw /tmp/ -f compile #or leave out the -nw

On the first run you won't notice anything special.

Now in the *compilation* buffer, type "g" for a second run (why needed? Bug?)

And there you see it, at the end of the line with all the 9's in it, (about 900 characters long.) There it is, "[...]"!

OK, now do

 (set-variable 'compilation-max-output-line-length 22)

And indeed, upon another "g" run, that 9's line becomes much shorter.

Now why only the 900 character long 9's line was affected in the first place sounds like a bug. Or maybe it also has to do with detected terminal width, and thus different users will see it on different lines.

Also, when the user examines the mysterious '[...]' all he can find out is "here is a nil button labeled 99999...".

So the average user will never figure out what might be doing the truncating. No amount of probing the "[...]" will reveal the answer. No mouseover to the rescue. Nothing.


(apropos-value "^400$" nil)

indeed is a way of finding that suspect compilation-max-output-line-length!

  • 1
    I expect the average user running M-x compile might look at the customize group for compilation.
    – phils
    Commented Apr 5 at 9:22
  • 1
    Go ahead and log a bug; but please -- leave out all of the drama. Provide the pertinent facts, and omit the needless fluff. Basically, don't write anything like: "Holy moly ... And there you see it ... There it is ... the average user will never figure out what might be doing the truncating. No amount of probing the "[...]" will reveal the answer. No mouseover to the rescue. Nothing."
    – phils
    Commented Apr 5 at 9:47
  • Thanks. I created debbugs.gnu.org/cgi/bugreport.cgi?bug=70236 but just pointing back here. Commented Apr 6 at 9:22
  • 1
    I think this answer could be Accepted.
    – phils
    Commented Apr 19 at 8:46
  • 1
    @DanJacobson: the above comment is meant for you. Only you can accept an answer (in this case, your own answer) to your question. You should be doing that with your questions that are answered (by you or by somebody else): it tells future users that somebody had this question and it was answered satisfactorily and it's part of how Stack Exchange works.
    – NickD
    Commented Apr 25 at 4:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.