From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: JD Smith Newsgroups: gmane.emacs.bugs Subject: bug#47657: python-shell font-lock with multi-line input: runaway fontification buffer length Date: Mon, 12 Apr 2021 09:18:13 -0400 Message-ID: <0BCE3A3A-7A11-465A-8057-0546097D99FA@gmail.com> References: <603226C1-620D-4C53-B8E9-A2ECA3A3DB3C@gmail.com> <87y2dnyhix.fsf@gnus.org> Mime-Version: 1.0 (Mac OS X Mail 13.4 \(3608.120.23.2.4\)) Content-Type: multipart/alternative; boundary="Apple-Mail=_BA8CFAA5-6801-4D71-823B-D20E999C86AC" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="36223"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 47657@debbugs.gnu.org To: Lars Ingebrigtsen Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Mon Apr 12 15:19:26 2021 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lVwTO-00096g-A5 for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 12 Apr 2021 15:19:26 +0200 Original-Received: from localhost ([::1]:41366 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lVwTN-0000wq-Ap for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 12 Apr 2021 09:19:25 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:51172) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lVwT0-0000vt-MU for bug-gnu-emacs@gnu.org; Mon, 12 Apr 2021 09:19:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:45312) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lVwT0-0005GS-EU for bug-gnu-emacs@gnu.org; Mon, 12 Apr 2021 09:19:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1lVwT0-00071b-AH for bug-gnu-emacs@gnu.org; Mon, 12 Apr 2021 09:19:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: JD Smith Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 12 Apr 2021 13:19:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 47657 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: moreinfo Original-Received: via spool by 47657-submit@debbugs.gnu.org id=B47657.161823350226953 (code B ref 47657); Mon, 12 Apr 2021 13:19:02 +0000 Original-Received: (at 47657) by debbugs.gnu.org; 12 Apr 2021 13:18:22 +0000 Original-Received: from localhost ([127.0.0.1]:56858 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lVwSM-00070f-Ib for submit@debbugs.gnu.org; Mon, 12 Apr 2021 09:18:22 -0400 Original-Received: from mail-io1-f46.google.com ([209.85.166.46]:38475) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lVwSK-00070P-Qu for 47657@debbugs.gnu.org; Mon, 12 Apr 2021 09:18:21 -0400 Original-Received: by mail-io1-f46.google.com with SMTP id f15so4626003iob.5 for <47657@debbugs.gnu.org>; Mon, 12 Apr 2021 06:18:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:message-id:mime-version:subject:date:in-reply-to:cc:to :references; bh=vjTzrsgoDP3oJKIhDziVjdMcmF56eLQQo2MG+e8Oh3M=; b=icbudc7e3M4ISEViuFZkMZ/JDHrFDYheW2gaWrpG5h6Gt1IF3LWwFw/fpNdck+RiCx 4++bD6a50hCxC15cqC4u4W21RSenC/2oUaZNZRNoBskJQcTMTnJu4dAp2LxrK1lTVeM8 VScTLhAwV2oq37wkYufjOqSJzWYZUf0lybh/LUC5qRt1JjPbefSQdrghuuZOVyil1XO9 699mvVggXdtCMjQPd3hIOd421EhgZNgdTnOGx+cCBuDKmPP9mgH65SUUZAcqrA6SEVnU fhDVWGKBoxFqkl7cBv6a07xX+mHilbqHApkaSA78jlVKThvP5Am2jBZf+giMPQenNBFg xSKQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:message-id:mime-version:subject:date :in-reply-to:cc:to:references; bh=vjTzrsgoDP3oJKIhDziVjdMcmF56eLQQo2MG+e8Oh3M=; b=BfKFwALv7l3X3WWIK78uPZDWUEVpmWRYOqaos26UYN+8Jbjw80OsgM4j5U2ReEbccA +HVVdfPhgyzYf6LMJhg9XXGu1sFYkLCmwziC5Fmh4coHFK67esp6YU7/E5L2DFUrrxjr Q0EDPdHb6gsWQ6430iyrJZK2wQ2wkqEtkrtpE68U/wsPdbrIYauFcEHOpURh1iL8zywT Bc9Yqkq0QTrAbdADf+VHS4MowaO7ungE5ma9A432Y2QIHhpJMxKHdta060yRjlDx9Zu7 Wq7gOr5A1xRn2umEu7x1J6oh+hQJb5tL7hxBr9x+X6JwGYnLo0soKyAYBtebii0vJAtV WFjw== X-Gm-Message-State: AOAM533ubXp1FbmyVBOwDu4vw39GQmQVSdTP3slz0JGQx1QMwosSm8sb 0BbzfbjAeflSUjOrRC3i4Z4= X-Google-Smtp-Source: ABdhPJykA4pH+SgQjy9nXgpYJG/Nik4Z3zkeHT0JucPYsWUG4Sb9ZyDR3yYACVzPiH39XtmvuB4V0Q== X-Received: by 2002:a05:6638:3884:: with SMTP id b4mr28369111jav.18.1618233495057; Mon, 12 Apr 2021 06:18:15 -0700 (PDT) Original-Received: from [192.168.0.118] (cm-134-228-54-223.buckeyecom.net. [134.228.54.223]) by smtp.gmail.com with ESMTPSA id u20sm5618895ilj.63.2021.04.12.06.18.14 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 12 Apr 2021 06:18:14 -0700 (PDT) In-Reply-To: <87y2dnyhix.fsf@gnus.org> X-Mailer: Apple Mail (2.3608.120.23.2.4) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:203896 Archived-At: --Apple-Mail=_BA8CFAA5-6801-4D71-823B-D20E999C86AC Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=utf-8 > On Apr 12, 2021, at 5:32 AM, Lars Ingebrigtsen wrote: >=20 > 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 =E2=80=9C *Python-font-lock*=E2=80=9D In inferior python shell: type any line. C-c SPC (`comint-accumulate=E2=80=99) to continue. Type another line. Notice the first line is repeated.=20 Repeat steps 5 & 6 several times.=20 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=E2=80=99t 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=E2=80=99m using that as part of a package to implement true = multi-line editing (ala iPython).= --Apple-Mail=_BA8CFAA5-6801-4D71-823B-D20E999C86AC Content-Transfer-Encoding: quoted-printable Content-Type: text/html; charset=utf-8

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?

  1. emacs = -Q
  2. M-x run-python
  3. C-x 5 b =E2=80=9C = *Python-font-lock*=E2=80=9D
  4. In inferior python shell: = type any line.
  5. C-c SPC (`comint-accumulate=E2=80=99) = to continue.
  6. Type another line.  Notice the = first line is repeated. 
  7. 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=E2=80=99t 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=E2=80=99m using that = as part of a package to implement true multi-line editing (ala = iPython).
= --Apple-Mail=_BA8CFAA5-6801-4D71-823B-D20E999C86AC--