From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Newsgroups: gmane.emacs.devel Subject: Re: master 90744ff0be 1/2: comint-fl: Prevent fontification of output as input Date: Thu, 06 Oct 2022 20:31:18 +0200 Message-ID: <874jwgu7m1.fsf@miha-pc> References: <831qrscabj.fsf@gnu.org> Mime-Version: 1.0 Content-Type: multipart/signed; boundary="==-=-="; micalg=pgp-sha256; protocol="application/pgp-signature" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="474"; mail-complaints-to="usenet@ciao.gmane.io" Cc: emacs-devel@gnu.org, Stefan Monnier To: Eli Zaretskii , Lars Ingebrigtsen Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Thu Oct 06 20:48:19 2022 Return-path: Envelope-to: ged-emacs-devel@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 1ogVus-000APj-SI for ged-emacs-devel@m.gmane-mx.org; Thu, 06 Oct 2022 20:48:19 +0200 Original-Received: from localhost ([::1]:58686 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ogVur-00076G-JS for ged-emacs-devel@m.gmane-mx.org; Thu, 06 Oct 2022 14:48:17 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:44890) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ogVQt-0005sh-MQ for emacs-devel@gnu.org; Thu, 06 Oct 2022 14:17:22 -0400 Original-Received: from kamnitnik.top ([2001:19f0:5001:bf2:5400:2ff:fee0:2626]:37026) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ogVQr-0000Z3-In; Thu, 06 Oct 2022 14:17:19 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kamnitnik.top; s=mail; t=1665080231; bh=1BlNY+0flt+RbSu5kqCLViRwR4wH+88YvLK0CEI0OvU=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From; b=pW2NP7ZtS3TtdPB0T9F7LThVLon6+wJkcOkBxOgPZnz6HsoCpwClicdpcLIpZac2g tW/wshjhhred+/NNZVgSLC/1tWUKnqGko0SorSf3ize/0lJtgEogCbLPpCBN3BGk+j wj/hE3kYpvL4oMg2C7ls+76ptUPgKqsRq7fky1XL0c89b7kWzDdxjkaLI9egnUMcBP pC40+m5YfY0N0+5uN9L1TJL389pm8VpsC/ippiMDZvWeqIPyjzpe1oFvFt/y/vYZrr CD5ZbN7jm9xHGYKq0/ZTwoA0sRJP0TNdbB/QhvcwX0LdFIxQC0PBNcr/HELSjr2mRh tHZourG7QRSmA== In-Reply-To: <831qrscabj.fsf@gnu.org> Received-SPF: pass client-ip=2001:19f0:5001:bf2:5400:2ff:fee0:2626; envelope-from=miha@kamnitnik.top; helo=kamnitnik.top X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FROM_SUSPICIOUS_NTLD=0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001, T_PDS_OTHER_BAD_TLD=0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.io gmane.emacs.devel:297112 Archived-At: --==-=-= Content-Type: multipart/mixed; boundary="=-=-=" --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Eli Zaretskii writes: >> branch: master >> commit 90744ff0be581b69cedea1194b7e78265bdb67a4 >> Author: Miha Rihtar=C5=A1i=C4=8D >> Commit: Lars Ingebrigtsen >>=20 >> comint-fl: Prevent fontification of output as input >>=20=20=20=20=20 >> * lisp/comint.el (comint-output-filter): Inhibit jit-lock >> fontification of inserted process output before marking it with the >> 'output' filed property (bug#58169). >> --- >> lisp/comint.el | 24 +++++++++++++----------- >> 1 file changed, 13 insertions(+), 11 deletions(-) >>=20 >> diff --git a/lisp/comint.el b/lisp/comint.el >> index e7d2136c84..15c9388ea4 100644 >> --- a/lisp/comint.el >> +++ b/lisp/comint.el >> @@ -2150,24 +2150,26 @@ Make backspaces delete the previous character." >> ;; insert-before-markers is a bad thing. XXX >> ;; Luckily we don't have to use it any more, we use >> ;; window-point-insertion-type instead. >> - (insert string) >> + (make-local-variable 'jit-lock-mode) >> + (let ((jit-lock-mode nil)) <<<<<<<<<<<<<<<<<<<<<<<<<<<< >> + (insert string) > > Isn't that hammer too large/blunt for this job? It will disable every > single function registered with jit-lock, not just the fontification > functions. Some of the functions registered with jit-lock have > nothing to do with fontifications. Sorry for late reply. I agree. Please consider applying the attached patches. See also reply https://debbugs.gnu.org/cgi/bugreport.cgi?bug=3D58169#31 --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=0001-Revert-comint-fl-Prevent-fontification-of-output-as-.patch Content-Transfer-Encoding: quoted-printable From=20f3edbf1484cfbab781d76c6d39f6157b8506224d Mon Sep 17 00:00:00 2001 From: =3D?UTF-8?q?Miha=3D20Rihtar=3DC5=3DA1i=3DC4=3D8D?=3D Date: Thu, 6 Oct 2022 19:06:37 +0200 Subject: [PATCH 1/2] Revert "comint-fl: Prevent fontification of output as input" This reverts commit 90744ff0be581b69cedea1194b7e78265bdb67a4. =2D-- lisp/comint.el | 24 +++++++++++------------- 1 file changed, 11 insertions(+), 13 deletions(-) diff --git a/lisp/comint.el b/lisp/comint.el index b1f3ad8259..e3eee8411c 100644 =2D-- a/lisp/comint.el +++ b/lisp/comint.el @@ -2150,26 +2150,24 @@ comint-output-filter ;; insert-before-markers is a bad thing. XXX ;; Luckily we don't have to use it any more, we use ;; window-point-insertion-type instead. =2D (make-local-variable 'jit-lock-mode) =2D (let ((jit-lock-mode nil)) =2D (insert string) + (insert string) =20 =2D ;; Advance process-mark =2D (set-marker (process-mark process) (point)) + ;; Advance process-mark + (set-marker (process-mark process) (point)) =20 =2D (unless comint-inhibit-carriage-motion + (unless comint-inhibit-carriage-motion ;; Interpret any carriage motion characters (newline, backspace) (comint-carriage-motion comint-last-output-start (point))) =20 =2D ;; Run these hooks with point where the user had it. =2D (goto-char saved-point) =2D (run-hook-with-args 'comint-output-filter-functions string) =2D (set-marker saved-point (point)) + ;; Run these hooks with point where the user had it. + (goto-char saved-point) + (run-hook-with-args 'comint-output-filter-functions string) + (set-marker saved-point (point)) =20 =2D (goto-char (process-mark process)) ; In case a filter moved it. + (goto-char (process-mark process)) ; In case a filter moved it. =20 =2D (unless comint-use-prompt-regexp =2D (comint--mark-as-output comint-last-output-start (point)= ))) + (unless comint-use-prompt-regexp + (comint--mark-as-output comint-last-output-start (point))) =20 ;; Highlight the prompt, where we define `prompt' to mean ;; the most recent output that doesn't end with a newline. =2D-=20 2.37.2 --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=0002-comint-fontify-input-Don-t-fontify-output-as-input-d.patch Content-Transfer-Encoding: quoted-printable From=202264b29ed709babf3f22668ea25ebde431845be7 Mon Sep 17 00:00:00 2001 From: =3D?UTF-8?q?Miha=3D20Rihtar=3DC5=3DA1i=3DC4=3D8D?=3D Date: Thu, 6 Oct 2022 20:22:39 +0200 Subject: [PATCH 2/2] comint-fontify-input: Don't fontify output as input, different approach * lisp/comint.el (comint-output-filter): Propertize process output with field=3Doutput before inserting it into buffer to prevent comint-fontify-input from fontifying it (bug#58169). =2D-- lisp/comint.el | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/lisp/comint.el b/lisp/comint.el index e3eee8411c..07ced8d321 100644 =2D-- a/lisp/comint.el +++ b/lisp/comint.el @@ -2147,6 +2147,12 @@ comint-output-filter (goto-char (process-mark process)) (set-marker comint-last-output-start (point)) =20 + ;; Before we call `comint--mark-as-output' later, + ;; redisplay can be called. We mark the inserted text as + ;; output early, to prevent redisplay from fontifying it + ;; as input in case of `comint-fontify-input-mode'. + (put-text-property 0 (length string) 'field 'output string) + ;; insert-before-markers is a bad thing. XXX ;; Luckily we don't have to use it any more, we use ;; window-point-insertion-type instead. =2D-=20 2.37.2 --=-=-=-- --==-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQJHBAEBCAAxFiEEmxVnesoT5rQXvVXnswkaGpIVmT8FAmM/HvYTHG1paGFAa2Ft bml0bmlrLnRvcAAKCRCzCRoakhWZP6X+D/9O6cUdykBUOhvkVjnstcOm+0IzDk3F qThurNVNgdWN9nRHZ9gXBhBWwQU+GRHPfZMxFWG50+2zL/2b71EwqzcLRoTlWotz hHF6b0hq/D06yP1ZyM2wouoWIy2xXpelCzfKr7xxfyKxkEIclJ8mBOdVyVmiM4yo TIy3I1XV3JuXBvAb1dOMbozBtxPbJWz/AmtzsB2WbQiRicJUN+9+qVmh/kE9O59F P70SxY0zY65yej8omL26RU2PrSkDukH4jvEeQ8995qvQJwheWw1K92ivp7cezcxo Yv86K/oVrInhUqyFwOfHxqcGxXeXMQRH8BvZ4BaOKF/DgetjIvwxrqzcWx+c1yC+ CuZ7XJcYQuYd925f+qsx5VSLsR3rtZnNrgUHXCxOX+Qb4GIr6ENiISTFbAqo8HOE HJ+T83CzLqD2hmogtdJgShgHx5+9hNhzvsmQry/H90t5n8OaajScP8haZN0JaAJc lUFxSGrrXJhjqxcZ3cO+x5vGM2+IGtgApROVSJPQ5cK17/TTLEhEtaOCZ/D1g4vt pABlx9EG0wNuCy7cW1BvuNuZ8c/NVz467Smd1wBA62B4wknuyMeT2rZArLSp4Mtz +BFX6nWdYvc6r+/FmlEq2JJb943S50XWtpXsp8f64jYvNvQ45xqsWHhG8dYcqIoU mK4ZZ2uvu+wu9w== =0bbj -----END PGP SIGNATURE----- --==-=-=--