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

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

bug#47657: python-shell font-lock with multi-line input: runaway fontifi


From: Lars Ingebrigtsen
Subject: bug#47657: python-shell font-lock with multi-line input: runaway fontification buffer length
Date: Mon, 12 Apr 2021 11:32:54 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux)

JD Smith <jdtsmith@gmail.com> writes:

> `python-shell-font-lock-post-command-hook’ makes the presumption that only a
> single line of input can appear at the prompt.  It includes this preparatory
> “clean-up” of its font lock buffer after first having copied all input lines 
> after the
> prompt:
>
>        (let* ((input (buffer-substring-no-properties
>                       prompt-end (point-max)))
>             ...
>               (replacement
>                (python-shell-font-lock-with-font-lock-buffer
>                  (delete-region (line-beginning-position)
>                                 (point-max))
>                  (setq font-lock-buffer-pos (point))
>                  (insert input)

I think the point here is that if we're in a multi-line expression, then
the font locking may be dependent on the previous lines, too, so we
can't just delete the contents of the buffer.

> Find an example, below.

[...]

> (In *Python* shell buffer):
>
> In [2]: a= 'now is the time'
> for i in range(12):
> a = 12; print(i+4-4) 
> b='one two one two and through and through'
> d='and I’ 
>
> (In " *Python-font-lock"; this can become arbitrarily long):
>
> a= 'now is the time'
> a= 'now is the time'

I was unable to reproduce this (in Emacs 28).  I pasted this into the
*Python* buffer:

a= 'now is the time'
for i in range(12):
    a = 12; print(i+4-4) 
    b='one two one two and through and through'
    d='and I'

and the font-lock buffer never became very big.

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

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





reply via email to

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