unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: JD Smith <jdtsmith@gmail.com>
To: Lars Ingebrigtsen <larsi@gnus.org>
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 09:18:13 -0400	[thread overview]
Message-ID: <0BCE3A3A-7A11-465A-8057-0546097D99FA@gmail.com> (raw)
In-Reply-To: <87y2dnyhix.fsf@gnus.org>

[-- Attachment #1: Type: text/plain, Size: 1174 bytes --]



> On Apr 12, 2021, at 5:32 AM, Lars Ingebrigtsen <larsi@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).

[-- Attachment #2: Type: text/html, Size: 2206 bytes --]

  reply	other threads:[~2021-04-12 13:18 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
2021-04-12 13:18   ` JD Smith [this message]
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=0BCE3A3A-7A11-465A-8057-0546097D99FA@gmail.com \
    --to=jdtsmith@gmail.com \
    --cc=47657@debbugs.gnu.org \
    --cc=larsi@gnus.org \
    /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).