From: miha--- via "Bug reports for GNU Emacs, the Swiss army knife of text editors" <bug-gnu-emacs@gnu.org>
To: Lars Ingebrigtsen <larsi@gnus.org>
Cc: 58169@debbugs.gnu.org, Augusto Stoffel <arstoffel@gmail.com>,
Visuwesh <visuweshm@gmail.com>
Subject: bug#58169: 29.0.50; comint-fl-mode fontifies the output
Date: Fri, 30 Sep 2022 20:38:54 +0200 [thread overview]
Message-ID: <87o7uwu2pt.fsf@miha-pc> (raw)
In-Reply-To: <87edvt56e3.fsf@gnus.org>
[-- Attachment #1.1: Type: text/plain, Size: 667 bytes --]
Lars Ingebrigtsen <larsi@gnus.org> writes:
> <miha@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
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1.2: 0001-comint-fl-Prevent-fontification-of-output-as-input.patch --]
[-- Type: text/x-patch, Size: 2334 bytes --]
From ddbad11131d0bfcdef33666c028f3d7070cefc31 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Miha=20Rihtar=C5=A1i=C4=8D?= <miha@kamnitnik.top>
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).
---
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
--- 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.
- (insert string)
+ (make-local-variable 'jit-lock-mode)
+ (let ((jit-lock-mode nil))
+ (insert string)
- ;; Advance process-mark
- (set-marker (process-mark process) (point))
+ ;; Advance process-mark
+ (set-marker (process-mark process) (point))
- (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)))
- ;; 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))
+ ;; 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))
- (goto-char (process-mark process)) ; In case a filter moved it.
+ (goto-char (process-mark process)) ; In case a filter moved it.
- (unless comint-use-prompt-regexp
- (comint--mark-as-output comint-last-output-start (point)))
+ (unless comint-use-prompt-regexp
+ (comint--mark-as-output comint-last-output-start (point))))
;; Highlight the prompt, where we define `prompt' to mean
;; the most recent output that doesn't end with a newline.
--
2.37.2
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1.3: 0002-comint-fl-New-descriptive-aliases-and-NEWS.patch --]
[-- Type: text/x-patch, Size: 3270 bytes --]
From f6d07520aaa2156957962397c59093d6b1c4acd7 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Miha=20Rihtar=C5=A1i=C4=8D?= <miha@kamnitnik.top>
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.
---
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
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -1214,6 +1214,14 @@ When nil, this prevents comint from deleting the current input when
inserting previous input using '<mouse-2>'. The default is t, to
preserve past behavior.
+---
+*** 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
---
@@ -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.
+---
+*** 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
+++
diff --git a/lisp/comint.el b/lisp/comint.el
index 15c9388ea4..3d7218b868 100644
--- a/lisp/comint.el
+++ b/lisp/comint.el
@@ -3978,6 +3978,8 @@ comint--indirect-buffer
(defvar-local comint--fl-saved-jit-lock-contextually nil)
+(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
--- a/lisp/ielm.el
+++ b/lisp/ielm.el
@@ -483,6 +483,8 @@ ielm-comint-fl-enable
:safe 'booleanp
:version "29.1")
+(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
--- a/lisp/shell.el
+++ b/lisp/shell.el
@@ -308,6 +308,8 @@ shell-input-autoexpand
(const :tag "on" t))
:group 'shell)
+(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
--
2.37.2
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 861 bytes --]
next prev parent reply other threads:[~2022-09-30 18:38 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-09-29 16:24 bug#58169: 29.0.50; comint-fl-mode fontifies the output Augusto Stoffel
2022-09-30 1:55 ` Visuwesh
2022-09-30 5:58 ` miha--- via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-09-30 13:38 ` Lars Ingebrigtsen
2022-09-30 18:38 ` miha--- via Bug reports for GNU Emacs, the Swiss army knife of text editors [this message]
2022-09-30 18:26 ` Lars Ingebrigtsen
2022-09-30 19:22 ` miha--- via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-09-30 19:14 ` Lars Ingebrigtsen
2022-10-01 14:43 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-10-06 18:37 ` miha--- via Bug reports for GNU Emacs, the Swiss army knife of text editors
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87o7uwu2pt.fsf@miha-pc \
--to=bug-gnu-emacs@gnu.org \
--cc=58169@debbugs.gnu.org \
--cc=arstoffel@gmail.com \
--cc=larsi@gnus.org \
--cc=miha@kamnitnik.top \
--cc=visuweshm@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).