GNU bug report logs - #58169
29.0.50; comint-fl-mode fontifies the output

Previous Next

Package: emacs;

Reported by: Augusto Stoffel <arstoffel <at> gmail.com>

Date: Thu, 29 Sep 2022 16:26:01 UTC

Severity: normal

Found in version 29.0.50

Fixed in version 29.1

Done: Lars Ingebrigtsen <larsi <at> gnus.org>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 58169 in the body.
You can then email your comments to 58169 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to miha <at> kamnitnik.top, bug-gnu-emacs <at> gnu.org:
bug#58169; Package emacs. (Thu, 29 Sep 2022 16:26:01 GMT) Full text and rfc822 format available.

Acknowledgement sent to Augusto Stoffel <arstoffel <at> gmail.com>:
New bug report received and forwarded. Copy sent to miha <at> kamnitnik.top, bug-gnu-emacs <at> gnu.org. (Thu, 29 Sep 2022 16:26:01 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Augusto Stoffel <arstoffel <at> gmail.com>
To: bug-gnu-emacs <at> gnu.org
Subject: 29.0.50; comint-fl-mode fontifies the output
Date: Thu, 29 Sep 2022 18:24:58 +0200
On emacs -Q, calling M-x shell and typing, say

  echo '#123'

prints some text with font-lock-comment-face.  Similarly

  echo '`123`'

prints text with the `sh-quoted-exec` face.  I wouldn't expect these
faces to be there, since the output is just output, not a comment or a
quoted exec.  If I turn off comint-fl-mode, then the output is not
fontified.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#58169; Package emacs. (Fri, 30 Sep 2022 01:56:02 GMT) Full text and rfc822 format available.

Message #8 received at 58169 <at> debbugs.gnu.org (full text, mbox):

From: Visuwesh <visuweshm <at> gmail.com>
To: Augusto Stoffel <arstoffel <at> gmail.com>
Cc: 58169 <at> debbugs.gnu.org,
 Miha Rihtaršič <miha <at> kamnitnik.top>
Subject: Re: bug#58169: 29.0.50; comint-fl-mode fontifies the output
Date: Fri, 30 Sep 2022 07:25:39 +0530
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.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#58169; Package emacs. (Fri, 30 Sep 2022 05:59:01 GMT) Full text and rfc822 format available.

Message #11 received at 58169 <at> debbugs.gnu.org (full text, mbox):

From: <miha <at> kamnitnik.top>
To: Visuwesh <visuweshm <at> gmail.com>, Augusto Stoffel <arstoffel <at> gmail.com>
Cc: 58169 <at> debbugs.gnu.org
Subject: Re: bug#58169: 29.0.50; comint-fl-mode fontifies the output
Date: Fri, 30 Sep 2022 07:58:09 +0200
Visuwesh <visuweshm <at> gmail.com> 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.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#58169; Package emacs. (Fri, 30 Sep 2022 13:39:01 GMT) Full text and rfc822 format available.

Message #14 received at 58169 <at> debbugs.gnu.org (full text, mbox):

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: <miha <at> kamnitnik.top>
Cc: 58169 <at> debbugs.gnu.org, Augusto Stoffel <arstoffel <at> gmail.com>,
 Visuwesh <visuweshm <at> gmail.com>
Subject: Re: bug#58169: 29.0.50; comint-fl-mode fontifies the output
Date: Fri, 30 Sep 2022 15:38:44 +0200
<miha <at> kamnitnik.top> 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.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#58169; Package emacs. (Fri, 30 Sep 2022 18:26:01 GMT) Full text and rfc822 format available.

Message #17 received at 58169 <at> debbugs.gnu.org (full text, mbox):

From: <miha <at> kamnitnik.top>
To: Lars Ingebrigtsen <larsi <at> gnus.org>
Cc: 58169 <at> debbugs.gnu.org, Augusto Stoffel <arstoffel <at> gmail.com>,
 Visuwesh <visuweshm <at> gmail.com>
Subject: Re: bug#58169: 29.0.50; comint-fl-mode fontifies the output
Date: Fri, 30 Sep 2022 20:38:54 +0200
[Message part 1 (text/plain, inline)]
Lars Ingebrigtsen <larsi <at> gnus.org> writes:

> <miha <at> kamnitnik.top> 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

[0001-comint-fl-Prevent-fontification-of-output-as-input.patch (text/x-patch, attachment)]
[0002-comint-fl-New-descriptive-aliases-and-NEWS.patch (text/x-patch, attachment)]
[signature.asc (application/pgp-signature, inline)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#58169; Package emacs. (Fri, 30 Sep 2022 18:28:02 GMT) Full text and rfc822 format available.

Message #20 received at 58169 <at> debbugs.gnu.org (full text, mbox):

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: <miha <at> kamnitnik.top>
Cc: 58169 <at> debbugs.gnu.org, Augusto Stoffel <arstoffel <at> gmail.com>,
 Visuwesh <visuweshm <at> gmail.com>
Subject: Re: bug#58169: 29.0.50; comint-fl-mode fontifies the output
Date: Fri, 30 Sep 2022 20:26:55 +0200
<miha <at> kamnitnik.top> writes:

> +(defalias 'comint-fontify-input-mode #'comint-fl-mode)

Thanks, but why aliases instead of just renaming the functions and
variables?




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#58169; Package emacs. (Fri, 30 Sep 2022 19:09:02 GMT) Full text and rfc822 format available.

Message #23 received at 58169 <at> debbugs.gnu.org (full text, mbox):

From: <miha <at> kamnitnik.top>
To: Lars Ingebrigtsen <larsi <at> gnus.org>
Cc: 58169 <at> debbugs.gnu.org, Augusto Stoffel <arstoffel <at> gmail.com>,
 Visuwesh <visuweshm <at> gmail.com>
Subject: Re: bug#58169: 29.0.50; comint-fl-mode fontifies the output
Date: Fri, 30 Sep 2022 21:22:27 +0200
[Message part 1 (text/plain, inline)]
Lars Ingebrigtsen <larsi <at> gnus.org> writes:

> <miha <at> kamnitnik.top> writes:
>
>> +(defalias 'comint-fontify-input-mode #'comint-fl-mode)
>
> Thanks, but why aliases instead of just renaming the functions and
> variables?

I originally thought that the function names could become too long. But
now I tried it and it's not so bad, so here are the revised patches
attached.
[0001-comint-fl-Prevent-fontification-of-output-as-input.patch (text/x-patch, attachment)]
[0002-Rename-comint-fl-to-comint-fontify-input-and-mention.patch (text/x-patch, attachment)]
[signature.asc (application/pgp-signature, inline)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#58169; Package emacs. (Fri, 30 Sep 2022 19:16:02 GMT) Full text and rfc822 format available.

Message #26 received at 58169 <at> debbugs.gnu.org (full text, mbox):

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: <miha <at> kamnitnik.top>
Cc: 58169 <at> debbugs.gnu.org, Augusto Stoffel <arstoffel <at> gmail.com>,
 Visuwesh <visuweshm <at> gmail.com>
Subject: Re: bug#58169: 29.0.50; comint-fl-mode fontifies the output
Date: Fri, 30 Sep 2022 21:14:48 +0200
<miha <at> kamnitnik.top> writes:

> I originally thought that the function names could become too long. But
> now I tried it and it's not so bad, so here are the revised patches
> attached.

Thanks; pushed to Emacs 29.




bug marked as fixed in version 29.1, send any further explanations to 58169 <at> debbugs.gnu.org and Augusto Stoffel <arstoffel <at> gmail.com> Request was from Lars Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Fri, 30 Sep 2022 19:16:02 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#58169; Package emacs. (Sat, 01 Oct 2022 14:44:02 GMT) Full text and rfc822 format available.

Message #31 received at 58169 <at> debbugs.gnu.org (full text, mbox):

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: <miha <at> kamnitnik.top>
Cc: 58169 <at> debbugs.gnu.org, Lars Ingebrigtsen <larsi <at> gnus.org>,
 Augusto Stoffel <arstoffel <at> gmail.com>, Visuwesh <visuweshm <at> gmail.com>
Subject: Re: bug#58169: 29.0.50; comint-fl-mode fontifies the output
Date: Sat, 01 Oct 2022 10:43:09 -0400
> @@ -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.
> -	    (insert string)
> +	    (make-local-variable 'jit-lock-mode)
> +	    (let ((jit-lock-mode nil))
> +	      (insert string)

Yuck!
Oh, and this will fail to do what it intends if the user has set
`font-lock-support-mode` t nil: don't confuse font-lock and jit-lock.

Also, I suspect that the above is not sufficient if you edit earlier
parts of the buffer (presumably previous inputs) which may cause later
parts to be *re*fontified.

A better way might be to change the font-lock rules to skip any text
that is marked as being output (e.g. by testing if the `field` property
is set to `output`).


        Stefan





Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#58169; Package emacs. (Thu, 06 Oct 2022 18:24:02 GMT) Full text and rfc822 format available.

Message #34 received at 58169 <at> debbugs.gnu.org (full text, mbox):

From: <miha <at> kamnitnik.top>
To: Stefan Monnier <monnier <at> iro.umontreal.ca>
Cc: 58169 <at> debbugs.gnu.org, Lars Ingebrigtsen <larsi <at> gnus.org>,
 Augusto Stoffel <arstoffel <at> gmail.com>, Visuwesh <visuweshm <at> gmail.com>
Subject: Re: bug#58169: 29.0.50; comint-fl-mode fontifies the output
Date: Thu, 06 Oct 2022 20:37:49 +0200
[Message part 1 (text/plain, inline)]
Stefan Monnier via "Bug reports for GNU Emacs, the Swiss army knife of
text editors" <bug-gnu-emacs <at> gnu.org> writes:

>> @@ -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.
>> -	    (insert string)
>> +	    (make-local-variable 'jit-lock-mode)
>> +	    (let ((jit-lock-mode nil))
>> +	      (insert string)
>
> Yuck!
> Oh, and this will fail to do what it intends if the user has set
> `font-lock-support-mode` t nil: don't confuse font-lock and jit-lock.
>
> Also, I suspect that the above is not sufficient if you edit earlier
> parts of the buffer (presumably previous inputs) which may cause later
> parts to be *re*fontified.
>
> A better way might be to change the font-lock rules to skip any text
> that is marked as being output (e.g. by testing if the `field` property
> is set to `output`).
>
>
>         Stefan

Thanks for feedback, discussion continued at
https://lists.gnu.org/r/emacs-devel/2022-10/msg00005.html.
[signature.asc (application/pgp-signature, inline)]

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Fri, 04 Nov 2022 11:24:11 GMT) Full text and rfc822 format available.

This bug report was last modified 2 years and 259 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.