On Tue, 8 Dec 2020 at 16:43, Lars Ingebrigtsen <larsi@gnus.org> wrote:
Reuben Thomas <rrt@sc3d.org> writes:

> If I add comint-truncate-buffer to comint-output-filter-functions, and
> set comint-buffer-maximum-size to 1024, then when a term buffer
> reaches about that size, and I run a command that produces a lot of
> output, then scroll back, some of the output is missing. In other
> words, rather than truncate from the top of the buffer, some of the
> truncation at least seems to happen much nearer the bottom.

(This bug report unfortunately got no response at the time.)

Do you have a step-by-step recipe to reproduce this error, starting from
"emacs -Q"?

If I try it now, it doesn't seem to truncate the buffer as expected: for example

emacs -Q
M-: (add-to-list 'comint-output-filter-functions 'comint-truncate-buffer)
M-x term
C-c M-x set-variable comint-buffer-maximum-size 256 ; do this after M-x term because before comint-buffer-maximum-size is not defined
$ seq 1 1024

The entire output is retained, and not truncated. Truncation seems to happen at 2048 lines. This does not even correspond to the original value of the variable (1024).

However, I cannot detect any truncation at the bottom of the output.

If I run C-c M-x comint-truncate-buffer, the buffer is truncated as expected, to 256 lines.

--
https://rrt.sc3d.org