In a fresh emacs session, each time I hit enter in inferior-python-mode, the window flickers.

enter image description here

This does not happen in shell-mode. One can see the cursor goes to the middle of current window when flickers happen.

How can I get rid of these flickers? Thanks.

Emacs version: GNU Emacs 26.1 (build 2, x86_64-apple-darwin17.5.0, Carbon Version 158 AppKit 1561.4) of 2018-05-25

  • How did you install Emacs? What config are you using?
    – Daniel
    Jul 30, 2018 at 17:03
  • 1
    See also Bug#31115.
    – npostavs
    Jul 31, 2018 at 1:10

2 Answers 2


See the variable comint-scroll-show-maximum-output, which may be somewhat at fault here for the behavior the O.P. experiences -- the default value is t:


Controls how to scroll due to interpreter output.
This variable applies when point is at the end of the buffer
(either because it was originally there, or because
‘comint-move-point-for-output’ said to move it there)
and output from the subprocess is inserted.

Non-nil means scroll so that the window is full of text
and point is on the last line.  A value of nil
means don’t do anything special--scroll normally.

See also the variable ‘comint-move-point-for-output’ and the function

This variable is buffer-local in all Comint buffers.

The flickering appears to be adjustment / scrolling based upon the default behavior of scroll-margin (and some additional re-adjusting by comint, possibly comint-scroll-whow-maximum-output); however, I have not done any real digging into comint and how it may recenter or adjust window-point after output is generated. I personally like (setq scroll-conservatively 101), which seems to fix the issue the O.P. has observed. Feel free to play with scroll-margin and related settings, but they are not necessary if using the aforementioned one-liner. [There is no need to set scroll-conservatively to a number beyond 101 as anything over 100 will have the same effect.]

It is possible to set scroll-conservatively locally with things like setq-local if the O.P. wishes for this to be buffer-local as to only this *Python* buffer.


From the bug reported:

Seems like (setq scroll-conservatively 1) works better to preserve the original behaviour

Worked for me. Having scroll-conservatively set to 1 make flickering less annoying.

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.