From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: miha--- via "Bug reports for GNU Emacs, the Swiss army knife of text editors" Newsgroups: gmane.emacs.bugs Subject: bug#58169: 29.0.50; comint-fl-mode fontifies the output Date: Fri, 30 Sep 2022 20:38:54 +0200 Message-ID: <87o7uwu2pt.fsf@miha-pc> References: <87h70qcfmt.fsf@gmail.com> <871qrt8w2s.fsf@gmail.com> <8735c976a6.fsf@miha-pc> <87edvt56e3.fsf@gnus.org> Reply-To: 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="25068"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 58169@debbugs.gnu.org, Augusto Stoffel , Visuwesh To: Lars Ingebrigtsen Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Fri Sep 30 20:26:23 2022 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 1oeKiM-0006M7-E4 for geb-bug-gnu-emacs@m.gmane-mx.org; Fri, 30 Sep 2022 20:26:23 +0200 Original-Received: from localhost ([::1]:43854 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oeKiL-0006Tl-AD for geb-bug-gnu-emacs@m.gmane-mx.org; Fri, 30 Sep 2022 14:26:21 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:59822) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oeKi2-0006TT-NF for bug-gnu-emacs@gnu.org; Fri, 30 Sep 2022 14:26:04 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:43817) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oeKi2-0004Il-7v for bug-gnu-emacs@gnu.org; Fri, 30 Sep 2022 14:26:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1oeKi1-00070j-RU for bug-gnu-emacs@gnu.org; Fri, 30 Sep 2022 14:26:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 30 Sep 2022 18:26:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 58169 X-GNU-PR-Package: emacs Original-Received: via spool by 58169-submit@debbugs.gnu.org id=B58169.166456230226876 (code B ref 58169); Fri, 30 Sep 2022 18:26:01 +0000 Original-Received: (at 58169) by debbugs.gnu.org; 30 Sep 2022 18:25:02 +0000 Original-Received: from localhost ([127.0.0.1]:42895 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oeKh3-0006zC-Fq for submit@debbugs.gnu.org; Fri, 30 Sep 2022 14:25:01 -0400 Original-Received: from kamnitnik.top ([209.250.245.214]:56240) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oeKh1-0006yw-8H for 58169@debbugs.gnu.org; Fri, 30 Sep 2022 14:25:00 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kamnitnik.top; s=mail; t=1664562298; bh=u7ZHQ7xAQf7GmPCYhBC5viv/13oZ0ZMlWu0Gw1nFC24=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From; b=lZaPGZqgFyncoss2ml4HHRfalsmg+oEmVA4yGYx2hcKFJ6tBuZYhxzy80Rz6UkXjA i1ennpMFTwaW/1eUJPlhyLRzaaSMvCjsRxanDIc9jFi1H+GS2vqSR47wOgJ2eOEvpX QgDslMXX2Eq0VGX71IV5Zucc7fq2UKGw4qh26pnbE6fChwugoEQq/BDwU4u3vX4tNg ZXdXivqFTfE+Oz1OOr9l6FmHy2nlg3fSXq1gF2m8EZU5vJQQchmbFJ1CsGDmKDiQOd Bkh2Q//5OyGYJViSpeL+auSbqQJLfD5Naj8lGGgT+dQnhQOkEBV2PFize/CkVAQSjb lKRmEcW1kYU4Q== In-Reply-To: <87edvt56e3.fsf@gnus.org> 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:244043 Archived-At: --==-=-= Content-Type: multipart/mixed; boundary="=-=-=" --=-=-= Content-Type: text/plain Lars Ingebrigtsen writes: > writes: > >>> Quickly hijacking this bug report to say: can we please announce >>> comint-fl-mode in NEWS, and say how to turn it off? I was confused when >>> M-x shell randomly started to fontify the input line despite me >>> disabling every font-lock related thing in *shell* buffers. >> >> Thanks for reporting, I'll have time to work one these issues in the >> afternoon. > > And I think we should probably rename it to `comint-font-lock-mode', > because the current name is obscure. I went with 'comint-fontify-input-mode'. I also made two more descriptive variable aliases. Patches attached --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=0001-comint-fl-Prevent-fontification-of-output-as-input.patch Content-Transfer-Encoding: quoted-printable From=20ddbad11131d0bfcdef33666c028f3d7070cefc31 Mon Sep 17 00:00:00 2001 From: =3D?UTF-8?q?Miha=3D20Rihtar=3DC5=3DA1i=3DC4=3D8D?=3D Date: Fri, 30 Sep 2022 20:07:03 +0200 Subject: [PATCH 1/2] comint-fl: Prevent fontification of output as input * lisp/comint.el (comint-output-filter): Inhibit jit-lock fontification of inserted process output before marking it with the 'output' filed property (bug#58169). =2D-- lisp/comint.el | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/lisp/comint.el b/lisp/comint.el index e7d2136c84..15c9388ea4 100644 =2D-- a/lisp/comint.el +++ b/lisp/comint.el @@ -2150,24 +2150,26 @@ 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 (insert string) + (make-local-variable 'jit-lock-mode) + (let ((jit-lock-mode nil)) + (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-fl-New-descriptive-aliases-and-NEWS.patch Content-Transfer-Encoding: quoted-printable From=20f6d07520aaa2156957962397c59093d6b1c4acd7 Mon Sep 17 00:00:00 2001 From: =3D?UTF-8?q?Miha=3D20Rihtar=3DC5=3DA1i=3DC4=3D8D?=3D Date: Fri, 30 Sep 2022 20:28:15 +0200 Subject: [PATCH 2/2] comint-fl: New descriptive aliases and NEWS * lisp/comint.el (comint-fontify-input-mode): New alias for 'comint-fl-mode' (bug#58169). * lisp/ielm.el (ielm-fontify-input-enable): New alias for 'ielm-comint-fl-enable'. * lisp/shell.el (shell-fontify-input-enable): New alias for 'shell-comint-fl-enable'. * etc/NEWS: Mention the new modes and how to turn them disable or enable them. =2D-- etc/NEWS | 14 ++++++++++++++ lisp/comint.el | 2 ++ lisp/ielm.el | 2 ++ lisp/shell.el | 2 ++ 4 files changed, 20 insertions(+) diff --git a/etc/NEWS b/etc/NEWS index aad1a17ae7..bce6a72481 100644 =2D-- a/etc/NEWS +++ b/etc/NEWS @@ -1214,6 +1214,14 @@ When nil, this prevents comint from deleting the cur= rent input when inserting previous input using ''. The default is t, to preserve past behavior. =20 +--- +*** New minor mode 'comint-fontify-input-mode'. +This minor mode is enabled by default in "*shell*" and "*ielm*" +buffers. It fontifies input text according to 'shell-mode' or +'emacs-lisp-mode' font-lock rules. Customize the user options +'shell-fontify-input-enable' and 'ielm-fontify-input-enable' to nil if +you don't want to enable input fontification by default. + ** Mwheel =20 --- @@ -2513,6 +2521,12 @@ behavior, customize the new 'eshell-lisp-form-nil-is= -failure' option. Enabling this will automatically kill a "*shell*" buffer as soon as the shell session terminates. =20 +--- +*** New minor mode 'shell-highlight-undef-mode' +Customize 'shell-highlight-undef-enable' to t if you want to enable +this minor mode in "*shell*" buffers. It will highlight undefined +commands with a warning face as you type. + ** Calc =20 +++ diff --git a/lisp/comint.el b/lisp/comint.el index 15c9388ea4..3d7218b868 100644 =2D-- a/lisp/comint.el +++ b/lisp/comint.el @@ -3978,6 +3978,8 @@ comint--indirect-buffer =20 (defvar-local comint--fl-saved-jit-lock-contextually nil) =20 +(defalias 'comint-fontify-input-mode #'comint-fl-mode) + (define-minor-mode comint-fl-mode "Enable input fontification in the current comint buffer. This minor mode is useful if the current major mode derives from diff --git a/lisp/ielm.el b/lisp/ielm.el index ad41cb1f6b..33a5fc8440 100644 =2D-- a/lisp/ielm.el +++ b/lisp/ielm.el @@ -483,6 +483,8 @@ ielm-comint-fl-enable :safe 'booleanp :version "29.1") =20 +(defvaralias 'ielm-fontify-input-enable 'ilem-comint-fl-enable) + (defcustom ielm-indirect-setup-hook nil "Hook run in an indirect buffer for input fontification. Input fontification and indentation of an IELM buffer, if diff --git a/lisp/shell.el b/lisp/shell.el index 18bb372242..33dcb248ab 100644 =2D-- a/lisp/shell.el +++ b/lisp/shell.el @@ -308,6 +308,8 @@ shell-input-autoexpand (const :tag "on" t)) :group 'shell) =20 +(defvaralias 'shell-fontify-input-enable 'shell-comint-fl-enable) + (defcustom shell-comint-fl-enable t "Enable fontification of input in shell buffers. This variable only has effect when the shell is started. Use the =2D-=20 2.37.2 --=-=-=-- --==-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQJHBAEBCAAxFiEEmxVnesoT5rQXvVXnswkaGpIVmT8FAmM3N74THG1paGFAa2Ft bml0bmlrLnRvcAAKCRCzCRoakhWZP4r+EADAqfjrfVdETp4S4qccJnN5eIAA4X6+ VgMrENUbVM4pxeU4OQWJ9NKUPsyvKCOmX5XMJK5FjkwMaZ+kF/L/Q1D2mpYoprV1 PqIFnT1sUblG0hMDaz7KTHY1Ra45C3Hi5Fs7oMHeBLC2Ausqh5WwqoP3jMlN/+aL pG9bUK2KPFuzDHU5CsY9OqimraQ+J4lS6yVU+bzlUGGUWJthvUSKXlxyQxXxXpcL 2eExFhZxXrSEvFcaNrqwUKJmi70RAbmtUwcLePw1cBnK7bZpOERoXbbrlThbxAtb zYo8vw6bAXptdZFvmrae+N9VjtunxbWoUpJylGPQaZCX/5rPui/m6I0Fza0mJ8fY o/CU3/obo2EX62d7lEfnP14to2M9YMwTrMp6BHdbhhgC5WIwLf7iek1KG9RLvSqk Bh/UdMb6Vt8W0YruJSsHrwOeUubKCM/iymnmjFy3hEvrLzLTFpfpWZUb/ucZCNti vGBXGnju1rVl2xBl+9F/11dnTM9u13lwHBw+OjNdacB0YUkvAl4OjwThPGRJgj+A dXEZiIDdQx5Mky+BijR/onvc+s6BoT5md3j27RLgsZL8u0gX0WAQBCDb7A5gaDed o9u9+0CHYYAMN9rYh9AAxEmQluQSoNnblOLrGArz+BKTXJUVcJLxHPa2BdPKf/2M ZLXIIYpH5Ib93g== =7u58 -----END PGP SIGNATURE----- --==-=-=--