LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   emacs in terminal-mode constrains output to 80 columns (emacs bug, or watch bug?) (https://www.linuxquestions.org/questions/linux-software-2/emacs-in-terminal-mode-constrains-output-to-80-columns-emacs-bug-or-watch-bug-882198/)

jgombos 05-23-2011 02:47 AM

emacs in terminal-mode constrains output to 80 columns (emacs bug, or watch bug?)
 
If emacs is in terminal-mode, it seems to constrain some tools to 80 columns of output, but not all tools. E.g. The following will correctly show 85 x's:
Code:

emacs -nw --eval='(terminal-emulator "*echo only*" "echo" '"'"'("xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"))'
But if you run watch inside an emacs terminal and use it to print 85 x's, wrapping will happen at column 80, even though there is actually plenty of width. E.g.
Code:

emacs -nw --eval='(terminal-emulator "*echo nested inside watch*" "watch" '"'"'("--interval" "3600" "echo xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"))'
What am I missing?

At first I thought the problem was with the watch command. However, this correctly shows 85 x's without wrapping:
Code:

watch --interval 3600 echo xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

ntubski 06-17-2011 09:49 PM

Quote:

If emacs is in terminal-mode, it seems to constrain some tools to 80 columns of output, but not all tools.
It seems like watch can't figure out the terminal width under emacs and defaults to 80 columns, not that it's being constrained. If you tell it the width it works as expected:
Code:

COLUMNS=85 emacs -Q -nw --eval='(terminal-emulator "*echo only*" "watch" '"'"'("echo xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"))'
I'm not sure what mechanism watch uses to discover the width under a normal terminal, but the fact that it fails under emacs suggests a bug in emacs to me.


All times are GMT -5. The time now is 01:54 AM.