Elpy: How to keep the python shell buffer scrolling down at all times

Created on 29 Aug 2019  路  5Comments  路  Source: jorgenschaefer/elpy

I desire a behaviour where upon C-c C-c the python shell (either already open or popping up) keeps scrolling down to display the most recent content.

Currently it only does so, when it is invoked the very first time. But if i press the execution key combination again, the buffer view just remains at the current position.

Does anyone know how to enable this?

Question

All 5 comments

By default, it is already supposed to do so, but only if the cursor is at the end of the buffer.

This part of the Emacs documentation mentions the variable comint-move-point-for-output which may be what you are looking for.

If so, you can set it for python interpreter buffer with something like this:

(add-hook 'inferior-python-mode-hook
          (lambda ()
            (setq comint-move-point-for-output t)))

Hope it helps.

thanks for your help but this does not seem to change anything oO

So there may be something wrong here.
Could you post the result of elpy-config and the way you configure elpy in your init.el (or similar) ?

In a meantime, you should be able to use this workaround to scroll to the bottom of the python interpreter every time you hit return:

(advice-add 'elpy-shell-send-region-or-buffer
            :before (lambda (&optional rest)
                      (let ((curbuf (current-buffer)))
                        (elpy-shell-switch-to-shell)
                        (goto-char (point-max))
                        (recenter -10)
                        (elpy-shell-switch-to-buffer)))
            '((name . "elpy-shell-scroll-to-bottom")))

it seems to work now after I restared emacs ?= thanks a lot!

The elpy-shell-send-region-or-buffer command is very usefully for me!

Actually, I would always want this behavior just to make sure there is no strange "side effect" caused by previous script run.

Maybe It could be added to the package?

Was this page helpful?
0 / 5 - 0 ratings

Related issues

kirk86 picture kirk86  路  5Comments

ghost picture ghost  路  5Comments

kapilsh picture kapilsh  路  3Comments

chechoRP picture chechoRP  路  5Comments

kootenpv picture kootenpv  路  3Comments