GNU bug report logs - #47657
python-shell font-lock with multi-line input: runaway fontification buffer length

Previous Next

Package: emacs;

Reported by: JD Smith <jdtsmith <at> gmail.com>

Date: Thu, 8 Apr 2021 15:49:02 UTC

Severity: normal

Fixed in version 29.1

Done: Lars Ingebrigtsen <larsi <at> gnus.org>

Bug is archived. No further changes may be made.

Full log


Message #13 received at 47657 <at> debbugs.gnu.org (full text, mbox):

From: JD Smith <jdtsmith <at> gmail.com>
To: Lars Ingebrigtsen <larsi <at> gnus.org>
Cc: 47657 <at> debbugs.gnu.org
Subject: Re: bug#47657: python-shell font-lock with multi-line input: runaway
 fontification buffer length
Date: Mon, 12 Apr 2021 09:18:13 -0400
[Message part 1 (text/plain, inline)]

> On Apr 12, 2021, at 5:32 AM, Lars Ingebrigtsen <larsi <at> gnus.org> wrote:
> 
> I was unable to reproduce this (in Emacs 28).  I pasted this into the
> *Python* buffer:

Pasting multiple lines constitutes a single command for post-command-hook. In that case you would not expect to see any repeated lines.

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

emacs -Q
M-x run-python
C-x 5 b “ *Python-font-lock*”
In inferior python shell: type any line.
C-c SPC (`comint-accumulate’) to continue.
Type another line.  Notice the first line is repeated. 
Repeat steps 5 & 6 several times. 

The issue is how input is gathered from the prompt to the end of shell buffer in the post-command-hook:

      (let* ((input (buffer-substring-no-properties
                     prompt-end (point-max)))

Line-at-a-time also won’t be able to handle editing lines before the last.  On emacs-devel Stefan has been helpful with some ideas to perform font lock in-place in the shell buffer, which is working well in my tests.  I’m using that as part of a package to implement true multi-line editing (ala iPython).
[Message part 2 (text/html, inline)]

This bug report was last modified 3 years and 278 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.