bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#35055: 27.0.50; async-shell-command truncates output lines


From: Juri Linkov
Subject: bug#35055: 27.0.50; async-shell-command truncates output lines
Date: Mon, 01 Apr 2019 23:44:59 +0300
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (x86_64-pc-linux-gnu)

>> 1. Open a wide frame and type:
>>
>> 2. `M-& ps aux RET'
>>
>> 3. observe that output lines are truncated at column 80
>
> In my case, output lines are truncated at column 89. In fact the
> truncation happens exactly at the size of the *Async Shell Command*
> buffer.

This is strange.  I tried in `emacs -Q' in a wide frame and
output lines of `ps aux' are always truncated at column 80.

Then I tried to affect the number of columns with the
environment variable COLUMNS, and when using

  M-& COLUMNS=89 ps aux

only then output lines are truncated at column 89.
Trying different values produced different truncation:

  COLUMNS=0 ps aux      - column 80
  COLUMNS=1 ps aux      - column 68
  COLUMNS=5 ps aux      - column 70
  COLUMNS=20 ps aux     - column 80
  COLUMNS=30 ps aux     - column 90
  COLUMNS=40 ps aux     - column 80
  COLUMNS=50 ps aux     - column 100
  COLUMNS=60 ps aux     - column 120
  COLUMNS=70 ps aux     - column 70
  COLUMNS=131071 ps aux - practically unlimited
  COLUMNS=131072 ps aux - again column 80 (looks like maximum reached)

i.e. dependency is not linear.

Also `M-x shell' uses `comint-term-environment' to set COLUMNS
to window-width, but it does this only initially,
so after resizing the shell window, COLUMNS remains
at the old initial value.

>> OTOH, there is no such problem with `M-! ps aux RET'
>> where lines are not truncated at all.
>>
>> So the question is: why `M-&' (async-shell-command) limits COLUMNS to 80,
>> even on wide frames, whereas `M-!' (shell-command) has no limitation.
>
> Internally, M-! uses `call-process', and M-& uses
> `start-file-process'. They have different implementations.
>
> Synchronous processes do not care about the buffer width. So you see
> untruncated output.
>
> Asynchronous processes care. They send the information about buffer
> dimensions with the function `set-process-window-size', see
> (info "(elisp) Process Buffers")
>
> There is the variable `window-adjust-process-window-size-function' which
> controls how the dimension information is given to the underlying
> process.

Thanks for the pointer to process-window-size functions.
I tried to debug them in `emacs -Q', not to affect its default
behavior with customization of async-shell-command-display-buffer
that complicates the issue more.

But it seems `set-process-window-size' has no effect on
the truncated columns.  I see that `set-process-window-size'
in `window--adjust-process-windows' is called with WIDTH
more than 80, but the output of `ps aux' is still truncated
to 80 columns in *Async Shell Command*.

> I'm not sure whether there exists already a configuration option to
> allow asynchronous shell commands using infinite line width, but it
> could be implemented this way.
>
> Note that for remote shell commands the situation is even worse, because
> it sets the process property `adjust-window-size-function' to nil,
> overwriting any setting in `window-adjust-process-window-size-function'.
> This affects even synchronous `shell-command' calls, because they are
> implemented Tramp internally as asynchronous process.

I had truncated output of remote `shell-command' for a long time
and thought that it's impossible to do anything with this,
but now that you mentioned remote shell commands, I tried
to affect their output with a quite large value of COLUMNS
and get untruncated output even on remote.





reply via email to

[Prev in Thread] Current Thread [Next in Thread]