From: Lars Ingebrigtsen <larsi@gnus.org>
To: JD Smith <jdtsmith@gmail.com>
Cc: 47657@debbugs.gnu.org
Subject: bug#47657: python-shell font-lock with multi-line input: runaway fontification buffer length
Date: Mon, 12 Apr 2021 11:32:54 +0200 [thread overview]
Message-ID: <87y2dnyhix.fsf@gnus.org> (raw)
In-Reply-To: <603226C1-620D-4C53-B8E9-A2ECA3A3DB3C@gmail.com> (JD Smith's message of "Thu, 8 Apr 2021 11:48:25 -0400")
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
next prev parent reply other threads:[~2021-04-12 9:32 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-04-08 15:48 bug#47657: python-shell font-lock with multi-line input: runaway fontification buffer length JD Smith
2021-04-12 9:32 ` Lars Ingebrigtsen [this message]
2021-04-12 13:18 ` JD Smith
2021-04-13 8:05 ` Lars Ingebrigtsen
2021-04-13 13:14 ` JD Smith
2021-04-25 17:34 ` Lars Ingebrigtsen
2021-04-25 17:53 ` JD Smith
2021-04-25 19:19 ` Lars Ingebrigtsen
2021-10-13 16:45 ` Lars Ingebrigtsen
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87y2dnyhix.fsf@gnus.org \
--to=larsi@gnus.org \
--cc=47657@debbugs.gnu.org \
--cc=jdtsmith@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).