From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Lars Ingebrigtsen Newsgroups: gmane.emacs.bugs Subject: bug#47657: python-shell font-lock with multi-line input: runaway fontification buffer length Date: Mon, 12 Apr 2021 11:32:54 +0200 Message-ID: <87y2dnyhix.fsf@gnus.org> References: <603226C1-620D-4C53-B8E9-A2ECA3A3DB3C@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="3367"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) Cc: 47657@debbugs.gnu.org To: JD Smith Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Mon Apr 12 11:34:25 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 1lVsxd-0000jV-Fo for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 12 Apr 2021 11:34:25 +0200 Original-Received: from localhost ([::1]:43550 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lVsxc-0007in-Hf for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 12 Apr 2021 05:34:24 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:48366) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lVsxG-0007ib-34 for bug-gnu-emacs@gnu.org; Mon, 12 Apr 2021 05:34:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:44929) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lVsxF-0007Ew-Qm for bug-gnu-emacs@gnu.org; Mon, 12 Apr 2021 05:34:01 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1lVsxF-0003BT-Nd for bug-gnu-emacs@gnu.org; Mon, 12 Apr 2021 05:34:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Lars Ingebrigtsen Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 12 Apr 2021 09:34:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 47657 X-GNU-PR-Package: emacs Original-Received: via spool by 47657-submit@debbugs.gnu.org id=B47657.161821998712075 (code B ref 47657); Mon, 12 Apr 2021 09:34:01 +0000 Original-Received: (at 47657) by debbugs.gnu.org; 12 Apr 2021 09:33:07 +0000 Original-Received: from localhost ([127.0.0.1]:56472 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lVswN-00038g-Er for submit@debbugs.gnu.org; Mon, 12 Apr 2021 05:33:07 -0400 Original-Received: from quimby.gnus.org ([95.216.78.240]:49304) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lVswL-00037z-R2 for 47657@debbugs.gnu.org; Mon, 12 Apr 2021 05:33:06 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnus.org; s=20200322; h=Content-Transfer-Encoding:Content-Type:MIME-Version:Message-ID :In-Reply-To:Date:References:Subject:Cc:To:From:Sender:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=nl+JxoAjg9dsYBhbKn4VFwWRZZh/zFoVT5gJmEH0pyA=; b=FptUE2imVOh2gzBkBUh2v3MM42 BgfZ21G9TnoA8SRDFtaOV8uevrePctWfqL3IPcICZxBKJmLqediteLaeCmuyyzUsfnzUgLK1c9XEG TmFxwcnkp+Ke9nlkOvaweh3KVswGh5FKxptWI/3bqztWpy0irAWyFBsfBhWoNT5Ri+Ts=; Original-Received: from cm-84.212.220.105.getinternet.no ([84.212.220.105] helo=xo) by quimby.gnus.org with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lVswB-0005mC-O4; Mon, 12 Apr 2021 11:32:58 +0200 X-Now-Playing: Marianne Faithfull's _A Child's Adventure_: "Blue Millionaire" In-Reply-To: <603226C1-620D-4C53-B8E9-A2ECA3A3DB3C@gmail.com> (JD Smith's message of "Thu, 8 Apr 2021 11:48:25 -0400") 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:203885 Archived-At: JD Smith writes: > `python-shell-font-lock-post-command-hook=E2=80=99 makes the presumption = that only a > single line of input can appear at the prompt. It includes this preparat= ory > =E2=80=9Cclean-up=E2=80=9D of its font lock buffer after first having cop= ied 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=3D 'now is the time' > for i in range(12): > a =3D 12; print(i+4-4)=20 > b=3D'one two one two and through and through' > d=3D'and I=E2=80=99=20 > > (In " *Python-font-lock"; this can become arbitrarily long): > > a=3D 'now is the time' > a=3D 'now is the time' I was unable to reproduce this (in Emacs 28). I pasted this into the *Python* buffer: a=3D 'now is the time' for i in range(12): a =3D 12; print(i+4-4)=20 b=3D'one two one two and through and through' d=3D'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? --=20 (domestic pets only, the antidote for overdose, milk.) bloggy blog: http://lars.ingebrigtsen.no