unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#31115: 26.1; python shell flicker
@ 2018-04-09 18:19 Charles A. Roelli
  2018-04-12  6:20 ` Andreas Röhler
  0 siblings, 1 reply; 4+ messages in thread
From: Charles A. Roelli @ 2018-04-09 18:19 UTC (permalink / raw)
  To: 31115

emacs -q
M-x run-python RET C-x o

Now press and hold down RET: a lot of prompts fly by, and as soon as
point reaches the bottom of the window, there is some flicker where
the cursor momentarily appears centered (as if `recenter' was run) and
simultaneously all the text in the buffer blinks as if the whole
screen was cleared and redrawn.  In contrast, if you try this same
recipe in a normal shell buffer from M-x shell, there won't be any
flicker.

Obviously, the above recipe is not a standard use case for a shell
buffer, but the same flicker is observed during normal use too.

A naive fix is to comment out the meat of python-comint-postoutput-
scroll-to-bottom, and reevaluate it:

(defun python-comint-postoutput-scroll-to-bottom (output)
  "Faster version of `comint-postoutput-scroll-to-bottom'.
Avoids `recenter' calls until OUTPUT is completely sent."
  ;; (when (and (not (string= "" output))
  ;;            (python-shell-comint-end-of-output-p
  ;;             (ansi-color-filter-apply output)))
  ;;   (comint-postoutput-scroll-to-bottom output))
  output)

I have no idea why that works, but it seems to help.  The function in
question was added in the following commit:

  commit a6dc66a5441bc6832c12d362edd2d886edc1612a
  Author: Fabián Ezequiel Gallina <fgallina@gnu.org>
  Date:   Sat Jul 26 23:02:38 2014 -0300

      Faster comint output.

      * lisp/progmodes/python.el:
      (python-comint-output-filter-function): Make obsolete.
      (python-comint-postoutput-scroll-to-bottom): New function.
      (inferior-python-mode): Set comint-output-filter-functions to a
      minimum.

      Fixes: debbugs:16875





^ permalink raw reply	[flat|nested] 4+ messages in thread

* bug#31115: 26.1; python shell flicker
  2018-04-09 18:19 bug#31115: 26.1; python shell flicker Charles A. Roelli
@ 2018-04-12  6:20 ` Andreas Röhler
  2018-04-14 14:42   ` Noam Postavsky
  0 siblings, 1 reply; 4+ messages in thread
From: Andreas Röhler @ 2018-04-12  6:20 UTC (permalink / raw)
  To: 31115

On 09.04.2018 20:19, Charles A. Roelli wrote:
> emacs -q
> M-x run-python RET C-x o
> 
> Now press and hold down RET: a lot of prompts fly by, and as soon as
> point reaches the bottom of the window, there is some flicker where
> the cursor momentarily appears centered (as if `recenter' was run) and
> simultaneously all the text in the buffer blinks as if the whole
> screen was cleared and redrawn.  In contrast, if you try this same
> recipe in a normal shell buffer from M-x shell, there won't be any
> flicker.
> 
> Obviously, the above recipe is not a standard use case for a shell
> buffer, but the same flicker is observed during normal use too.
> 
> A naive fix is to comment out the meat of python-comint-postoutput-
> scroll-to-bottom, and reevaluate it:
> 
> (defun python-comint-postoutput-scroll-to-bottom (output)
>    "Faster version of `comint-postoutput-scroll-to-bottom'.
> Avoids `recenter' calls until OUTPUT is completely sent."
>    ;; (when (and (not (string= "" output))
>    ;;            (python-shell-comint-end-of-output-p
>    ;;             (ansi-color-filter-apply output)))
>    ;;   (comint-postoutput-scroll-to-bottom output))
>    output)
> 
> I have no idea why that works, but it seems to help.  The function in
> question was added in the following commit:
> 
>    commit a6dc66a5441bc6832c12d362edd2d886edc1612a
>    Author: Fabián Ezequiel Gallina <fgallina@gnu.org>
>    Date:   Sat Jul 26 23:02:38 2014 -0300
> 
>        Faster comint output.
> 
>        * lisp/progmodes/python.el:
>        (python-comint-output-filter-function): Make obsolete.
>        (python-comint-postoutput-scroll-to-bottom): New function.
>        (inferior-python-mode): Set comint-output-filter-functions to a
>        minimum.
> 
>        Fixes: debbugs:16875
> 
> 
> 

Can't reproduce with GNU Emacs 26.1 (build 1, i686-pc-linux-gnu, GTK+ 
Version 3.14.5) of 2018-04-10 at Debian





^ permalink raw reply	[flat|nested] 4+ messages in thread

* bug#31115: 26.1; python shell flicker
  2018-04-12  6:20 ` Andreas Röhler
@ 2018-04-14 14:42   ` Noam Postavsky
  2022-05-07 11:56     ` Lars Ingebrigtsen
  0 siblings, 1 reply; 4+ messages in thread
From: Noam Postavsky @ 2018-04-14 14:42 UTC (permalink / raw)
  To: Andreas Röhler; +Cc: 31115

severity 31115 minor
tags 31115 + confirmed
quit

Andreas Röhler <andreas.roehler@easy-emacs.de> writes:

> On 09.04.2018 20:19, Charles A. Roelli wrote:
>> emacs -q
>> M-x run-python RET C-x o
>>
>> Now press and hold down RET: a lot of prompts fly by, and as soon as
>> point reaches the bottom of the window, there is some flicker where
>> the cursor momentarily appears centered (as if `recenter' was run) and
>> simultaneously all the text in the buffer blinks as if the whole
>> screen was cleared and redrawn.  In contrast, if you try this same
>> recipe in a normal shell buffer from M-x shell, there won't be any
>> flicker.

> Can't reproduce with GNU Emacs 26.1 (build 1, i686-pc-linux-gnu, GTK+
> Version 3.14.5) of 2018-04-10 at Debian

I can reproduce on Emacs 26, both lucid and GTK builds.  Seems pretty
straightforward: point reaches the end of buffer, so Emacs autoscrolls
by half a window, then python-comint-postoutput-scroll-to-bottom kicks
in and scrolls back to the bottom.

>> A naive fix is to comment out the meat of python-comint-postoutput-
>> scroll-to-bottom, and reevaluate it:
>> 
>> (defun python-comint-postoutput-scroll-to-bottom (output)
>>   "Faster version of `comint-postoutput-scroll-to-bottom'.
>> Avoids `recenter' calls until OUTPUT is completely sent."
>>   ;; (when (and (not (string= "" output))
>>   ;;            (python-shell-comint-end-of-output-p
>>   ;;             (ansi-color-filter-apply output)))
>>   ;;   (comint-postoutput-scroll-to-bottom output))
>>   output)

Right, that help because Emacs no longer scrolls the window back to the
bottom.  Seems like (setq scroll-conservatively 1) works better to
preserve the original behaviour (I feel like that's too easy, so I must
be missing something though).





^ permalink raw reply	[flat|nested] 4+ messages in thread

* bug#31115: 26.1; python shell flicker
  2018-04-14 14:42   ` Noam Postavsky
@ 2022-05-07 11:56     ` Lars Ingebrigtsen
  0 siblings, 0 replies; 4+ messages in thread
From: Lars Ingebrigtsen @ 2022-05-07 11:56 UTC (permalink / raw)
  To: Noam Postavsky; +Cc: Andreas Röhler, 31115

Noam Postavsky <npostavs@gmail.com> writes:

> Right, that help because Emacs no longer scrolls the window back to the
> bottom.  Seems like (setq scroll-conservatively 1) works better to
> preserve the original behaviour (I feel like that's too easy, so I must
> be missing something though).

Seems to work perfectly, so I've now done this in Emacs 29.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no





^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2022-05-07 11:56 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-04-09 18:19 bug#31115: 26.1; python shell flicker Charles A. Roelli
2018-04-12  6:20 ` Andreas Röhler
2018-04-14 14:42   ` Noam Postavsky
2022-05-07 11:56     ` Lars Ingebrigtsen

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).