GNU bug report logs - #31915
26.0.50; highlight-regexp does not highlight regexp

Previous Next

Package: emacs;

Reported by: Markus Triska <triska <at> metalevel.at>

Date: Wed, 20 Jun 2018 16:27:02 UTC

Severity: minor

Found in version 26.0.50

To reply to this bug, email your comments to 31915 AT debbugs.gnu.org.

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#31915; Package emacs. (Wed, 20 Jun 2018 16:27:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Markus Triska <triska <at> metalevel.at>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Wed, 20 Jun 2018 16:27:02 GMT) Full text and rfc822 format available.

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

From: Markus Triska <triska <at> metalevel.at>
To: bug-gnu-emacs <at> gnu.org
Subject: 26.0.50; highlight-regexp does not highlight regexp
Date: Wed, 20 Jun 2018 18:26:13 +0200
Please invoke Emacs via:

    $ emacs -Q --eval "(let ((x \"x\"))                 \
                         (find-file x)                  \
                         (insert x)                     \
                         (highlight-regexp x 'hi-green) \
                         (when font-lock-mode (insert x)))"

The docstring of highlight-regexp states:

    Use Font lock mode, if enabled, to highlight REGEXP.  Otherwise,
    use overlays for highlighting.  If overlays are used, the
    highlighting will not update as you type.

Since font-lock-mode is clearly enabled when the second "x" is inserted,
I expect it to be highlighted. However, only the first "x" is highlighted.

Could you please adapt the docstring or, alternatively, highlight-regexp
to match what is documented with what is observed? Personally, I would
prefer that also the second "x" be highlighted in this case. Thank you!


In GNU Emacs 26.0.50.1 (x86_64-unknown-linux-gnu, X toolkit, Xaw scroll bars)
 of 2016-10-21 built on my computer
Repository revision: 0929e061fb544c0f4c10ff0412a41cf7e8148270
System Description:	Debian GNU/Linux 9.3 (stretch)


Configured using:
 'configure --with-gif=no --with-tiff=no --with-gnutls=no'

Configured features:
XPM JPEG PNG SOUND NOTIFY FREETYPE XFT ZLIB TOOLKIT_SCROLL_BARS LUCID
X11





Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#31915; Package emacs. (Wed, 20 Jun 2018 17:08:01 GMT) Full text and rfc822 format available.

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

From: Eli Zaretskii <eliz <at> gnu.org>
To: Markus Triska <triska <at> metalevel.at>
Cc: 31915 <at> debbugs.gnu.org
Subject: Re: bug#31915: 26.0.50; highlight-regexp does not highlight regexp
Date: Wed, 20 Jun 2018 20:07:51 +0300
> From: Markus Triska <triska <at> metalevel.at>
> Date: Wed, 20 Jun 2018 18:26:13 +0200
> 
> Please invoke Emacs via:
> 
>     $ emacs -Q --eval "(let ((x \"x\"))                 \
>                          (find-file x)                  \
>                          (insert x)                     \
>                          (highlight-regexp x 'hi-green) \
>                          (when font-lock-mode (insert x)))"
> 
> The docstring of highlight-regexp states:
> 
>     Use Font lock mode, if enabled, to highlight REGEXP.  Otherwise,
>     use overlays for highlighting.  If overlays are used, the
>     highlighting will not update as you type.
> 
> Since font-lock-mode is clearly enabled when the second "x" is inserted,
> I expect it to be highlighted.

Actually, that buffer is in Fundamental mode, where there's no
font-lock.  Somehow, I suspect you already know that.

> Could you please adapt the docstring or, alternatively, highlight-regexp
> to match what is documented with what is observed?

Would it suffice to say "Note that in Fundamental mode, there's no
font lock, so overlays are always used"?  Or did you mean something
else?

Thanks.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#31915; Package emacs. (Wed, 20 Jun 2018 17:33:02 GMT) Full text and rfc822 format available.

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

From: Michael Heerdegen <michael_heerdegen <at> web.de>
To: Markus Triska <triska <at> metalevel.at>
Cc: 31915 <at> debbugs.gnu.org
Subject: Re: bug#31915: 26.0.50; highlight-regexp does not highlight regexp
Date: Wed, 20 Jun 2018 19:32:20 +0200
Markus Triska <triska <at> metalevel.at> writes:

> Since font-lock-mode is clearly enabled when the second "x" is inserted,
> I expect it to be highlighted. However, only the first "x" is highlighted.

"If overlays are used, the highlighting will not update as you type."
Do you want to clarify that this also applies to text that is inserted
without typing it?


Michael.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#31915; Package emacs. (Wed, 20 Jun 2018 21:23:02 GMT) Full text and rfc822 format available.

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

From: Markus Triska <triska <at> metalevel.at>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 31915 <at> debbugs.gnu.org
Subject: Re: bug#31915: 26.0.50; highlight-regexp does not highlight regexp
Date: Wed, 20 Jun 2018 23:22:53 +0200
Eli Zaretskii <eliz <at> gnu.org> writes:

> Actually, that buffer is in Fundamental mode, where there's no
> font-lock.  Somehow, I suspect you already know that.

In the snippet I posted, I used the variable font-lock-mode to test
whether font-lock is enabled. Its documentation states:

    Non-nil if Font-Lock mode is enabled.

Is this documentation valid? If not, could you please adapt it, or -
alternatively - make the implementation match the description?

> Would it suffice to say "Note that in Fundamental mode, there's no
> font lock, so overlays are always used"?  Or did you mean something
> else?

Personally, I suspect that adding this would not cover all cases. I get
this impression from looking at hi-lock-set-pattern:

      (if (and font-lock-mode (font-lock-specified-p major-mode))

This condition seems to be different from what is documented.

Thank you and all the best,
Markus




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#31915; Package emacs. (Wed, 20 Jun 2018 21:27:01 GMT) Full text and rfc822 format available.

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

From: Markus Triska <triska <at> metalevel.at>
To: Michael Heerdegen <michael_heerdegen <at> web.de>
Cc: 31915 <at> debbugs.gnu.org
Subject: Re: bug#31915: 26.0.50; highlight-regexp does not highlight regexp
Date: Wed, 20 Jun 2018 23:26:38 +0200
Michael Heerdegen <michael_heerdegen <at> web.de> writes:

> "If overlays are used, the highlighting will not update as you type."
> Do you want to clarify that this also applies to text that is inserted
> without typing it?

This would be a welcome clarification, since it seems to be the case!

All the best,
Markus




This bug report was last modified 6 years and 360 days ago.

Previous Next


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