GNU bug report logs - #59626
29.0.50; [PATCH] comint-fontify-input: Fix field boundary issue

Previous Next

Package: emacs;

Reported by: miha <at> kamnitnik.top

Date: Sun, 27 Nov 2022 09:23:02 UTC

Severity: normal

Tags: patch

Found in version 29.0.50

Done: Eli Zaretskii <eliz <at> gnu.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 59626 in the body.
You can then email your comments to 59626 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 bug-gnu-emacs <at> gnu.org:
bug#59626; Package emacs. (Sun, 27 Nov 2022 09:23:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to miha <at> kamnitnik.top:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Sun, 27 Nov 2022 09:23:02 GMT) Full text and rfc822 format available.

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

From: miha <at> kamnitnik.top
To: bug-gnu-emacs <at> gnu.org
Subject: 29.0.50; [PATCH] comint-fontify-input: Fix field boundary issue
Date: Sun, 27 Nov 2022 10:23:57 +0100
[Message part 1 (text/plain, inline)]
Please find attached a patch which fixes a minor issue with narrowing to
fields during comint input fontification. The issue didn't cause any
visible bugs that I know of, I only noticed it during experimentation
with tree-sitter integration.

Not that my copyright paperwork renewal is currently in progress, but I
hope that the number of lines in this patch fall below the threshold.

[0001-comint-fontify-input-Fix-field-boundary-issue.patch (text/x-patch, attachment)]
[signature.asc (application/pgp-signature, inline)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#59626; Package emacs. (Sun, 27 Nov 2022 09:40:02 GMT) Full text and rfc822 format available.

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

From: Eli Zaretskii <eliz <at> gnu.org>
To: miha <at> kamnitnik.top
Cc: 59626 <at> debbugs.gnu.org
Subject: Re: bug#59626: 29.0.50;
 [PATCH] comint-fontify-input: Fix field boundary issue
Date: Sun, 27 Nov 2022 11:39:31 +0200
> Date: Sun, 27 Nov 2022 10:23:57 +0100
> From: miha--- via "Bug reports for GNU Emacs,
>  the Swiss army knife of text editors" <bug-gnu-emacs <at> gnu.org>
> 
> Please find attached a patch which fixes a minor issue with narrowing to
> fields during comint input fontification. The issue didn't cause any
> visible bugs that I know of, I only noticed it during experimentation
> with tree-sitter integration.

Thanks.  Do you have a recipe for demonstrating the problem which you are
trying to fix?

> Not that my copyright paperwork renewal is currently in progress, but I
> hope that the number of lines in this patch fall below the threshold.

Since when your previous assignment became outdated?  I need to know that to
make sure the cumulative amount of changes we already received from you
doesn't exceed the limit.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#59626; Package emacs. (Sun, 27 Nov 2022 12:22:01 GMT) Full text and rfc822 format available.

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

From: <miha <at> kamnitnik.top>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 59626 <at> debbugs.gnu.org
Subject: Re: bug#59626: 29.0.50; [PATCH] comint-fontify-input: Fix field
 boundary issue
Date: Sun, 27 Nov 2022 13:22:50 +0100
[Message part 1 (text/plain, inline)]
Eli Zaretskii <eliz <at> gnu.org> writes:

>> Date: Sun, 27 Nov 2022 10:23:57 +0100
>> From: miha--- via "Bug reports for GNU Emacs,
>>  the Swiss army knife of text editors" <bug-gnu-emacs <at> gnu.org>
>> 
>> Please find attached a patch which fixes a minor issue with narrowing to
>> fields during comint input fontification. The issue didn't cause any
>> visible bugs that I know of, I only noticed it during experimentation
>> with tree-sitter integration.
>
> Thanks.  Do you have a recipe for demonstrating the problem which you are
> trying to fix?

Instrument comint input fontification with this diff:

diff --git a/lisp/comint.el b/lisp/comint.el
index f47e6089f2..c83da95ad2 100644
--- a/lisp/comint.el
+++ b/lisp/comint.el
@@ -4083,7 +4083,10 @@ comint--fontify-input-fontify-region
            nil (lambda (beg end)
                  (unless (get-text-property
                           beg 'comint--fontify-input-inhibit-fontification)
-                   (font-lock-fontify-region beg end verbose)))
+                   (font-lock-fontify-region beg end verbose)
+                   ;; Output contents of the visible portion of the
+                   ;; buffer to *Messages*.
+                   (message "%S" (buffer-substring-no-properties (point-min) (point-max)))))
            beg end)))
     (`((jit-lock-bounds ,beg1 . ,_) . (jit-lock-bounds ,_ . ,end1))
      (setq beg (min beg beg1))

Now open up an M-x shell and type "date RET" into the buffer to make
your shell output the current date and an new prompt. Press "C-p C-p
C-e" to move point to "date" and change it into "datee".

Open up *Messages* and find the following strings:

"date"

"date
"

"datee
Sun Nov 27 01:05:27 PM CET 2022
~$ "

These strings represent the context in which shell fontification was
performed on the input. The last one includes "Sun Nov 27 01:05:27 PM
CET 2022\n~$ ", which is a mistake that this patch attempts to fix.
However, in pretty much all cases, this didn't result in any user
visible inaccuracies, since shell fontification of a command rarely
depends on the contents of the lines that follow it.

>> Not that my copyright paperwork renewal is currently in progress, but I
>> hope that the number of lines in this patch fall below the threshold.
>
> Since when your previous assignment became outdated?  I need to know that to
> make sure the cumulative amount of changes we already received from you
> doesn't exceed the limit.

24. of October this year.

Thanks, best regards.
[signature.asc (application/pgp-signature, inline)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#59626; Package emacs. (Sun, 27 Nov 2022 12:27:01 GMT) Full text and rfc822 format available.

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

From: Eli Zaretskii <eliz <at> gnu.org>
To: <miha <at> kamnitnik.top>
Cc: 59626 <at> debbugs.gnu.org
Subject: Re: bug#59626: 29.0.50; [PATCH] comint-fontify-input: Fix field
 boundary issue
Date: Sun, 27 Nov 2022 14:27:14 +0200
> From: <miha <at> kamnitnik.top>
> Cc: 59626 <at> debbugs.gnu.org
> Date: Sun, 27 Nov 2022 13:22:50 +0100
> 
> > Thanks.  Do you have a recipe for demonstrating the problem which you are
> > trying to fix?
> 
> Instrument comint input fontification with this diff:
> 
> diff --git a/lisp/comint.el b/lisp/comint.el
> index f47e6089f2..c83da95ad2 100644
> --- a/lisp/comint.el
> +++ b/lisp/comint.el
> @@ -4083,7 +4083,10 @@ comint--fontify-input-fontify-region
>             nil (lambda (beg end)
>                   (unless (get-text-property
>                            beg 'comint--fontify-input-inhibit-fontification)
> -                   (font-lock-fontify-region beg end verbose)))
> +                   (font-lock-fontify-region beg end verbose)
> +                   ;; Output contents of the visible portion of the
> +                   ;; buffer to *Messages*.
> +                   (message "%S" (buffer-substring-no-properties (point-min) (point-max)))))
>             beg end)))
>      (`((jit-lock-bounds ,beg1 . ,_) . (jit-lock-bounds ,_ . ,end1))
>       (setq beg (min beg beg1))
> 
> Now open up an M-x shell and type "date RET" into the buffer to make
> your shell output the current date and an new prompt. Press "C-p C-p
> C-e" to move point to "date" and change it into "datee".
> 
> Open up *Messages* and find the following strings:
> 
> "date"
> 
> "date
> "
> 
> "datee
> Sun Nov 27 01:05:27 PM CET 2022
> ~$ "
> 
> These strings represent the context in which shell fontification was
> performed on the input. The last one includes "Sun Nov 27 01:05:27 PM
> CET 2022\n~$ ", which is a mistake that this patch attempts to fix.
> However, in pretty much all cases, this didn't result in any user
> visible inaccuracies, since shell fontification of a command rarely
> depends on the contents of the lines that follow it.

Thanks, I will study this.

> >> Not that my copyright paperwork renewal is currently in progress, but I
> >> hope that the number of lines in this patch fall below the threshold.
> >
> > Since when your previous assignment became outdated?  I need to know that to
> > make sure the cumulative amount of changes we already received from you
> > doesn't exceed the limit.
> 
> 24. of October this year.

Then it's okay to install this without an assignment (when we decide to
install it).




Reply sent to Eli Zaretskii <eliz <at> gnu.org>:
You have taken responsibility. (Wed, 07 Dec 2022 15:45:03 GMT) Full text and rfc822 format available.

Notification sent to miha <at> kamnitnik.top:
bug acknowledged by developer. (Wed, 07 Dec 2022 15:45:03 GMT) Full text and rfc822 format available.

Message #19 received at 59626-done <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: miha <at> kamnitnik.top
Cc: 59626-done <at> debbugs.gnu.org
Subject: Re: bug#59626: 29.0.50;
 [PATCH] comint-fontify-input: Fix field boundary issue
Date: Wed, 07 Dec 2022 17:43:43 +0200
> Date: Sun, 27 Nov 2022 10:23:57 +0100
> From: miha--- via "Bug reports for GNU Emacs,
>  the Swiss army knife of text editors" <bug-gnu-emacs <at> gnu.org>
> 
> Please find attached a patch which fixes a minor issue with narrowing to
> fields during comint input fontification. The issue didn't cause any
> visible bugs that I know of, I only noticed it during experimentation
> with tree-sitter integration.
> 
> Not that my copyright paperwork renewal is currently in progress, but I
> hope that the number of lines in this patch fall below the threshold.

Thanks, installed on the master branch, and closing the bug.




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Thu, 05 Jan 2023 12:24:05 GMT) Full text and rfc822 format available.

This bug report was last modified 1 year and 109 days ago.

Previous Next


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