bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#25841: 25.2; Highlighting not being updated in some modes.


From: Stefan Kangas
Subject: bug#25841: 25.2; Highlighting not being updated in some modes.
Date: Wed, 21 Aug 2019 04:09:38 +0200

Stephen Berman <stephen.berman@gmx.net> writes:

> On Thu, 23 Feb 2017 12:21:38 +0000 Paul Whittaker <emacs@pdw.org.uk> wrote:
>
>> On 22/02/17 22:02, Glenn Morris wrote:
>>> This is the documented way highlight-regexp behaves:
>>>
>>>     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.
>>
>> Thanks, I'd missed that.
>>
>> I'm trying to get dynamic (non-overlay) highlighting working in a plain
>> text mode.  That documentation makes me think that I just need to enable
>> font-lock mode, but doing that doesn't appear to make any difference.
>>
>>   emacs -Q
>>   M-x fundamental-mode RET
>>   M-1 M-x font-lock-mode RET
>>   M-x highlight-regexp RET foo RET hi-yellow RET
>>
>>   f o o SPC b a r  ;; Not highlighted, as before.
>>
>> Would you expect that to work, or is there something else that I'm
>> missing here?  Apologies if this is a stupid question: I suspect I'm not
>> seeing all of the picture.
>
> I can't explain how font-lock works, but by experimenting it appears you
> have to set font-lock-defaults to a non-nil value in the buffer (it
> seems before enabling font-lock-mode, though there's an interaction I
> don't understand).  Here's a recipe:
>
> 0. emacs -Q
> 1. C-x b a RET ; Switch to new buffer "a".
> 2. Enter some text, e.g. "foo".
> 3. M-x font-lock-mode RET ; Disable font-lock-mode in the buffer --
>                           ; by default it's enabled globally .
> 4. M-: (setq-local font-lock-defaults (list 'bla)) RET
> 5. M-x font-lock-mode RET ; Re-enable font-lock-mode.  On one test I
>                           ; thought this was sufficient, but on
>                           ; subsequent repetition I've consistently
>                           ; gotten a void variable error and had to
>                           ; disable and then re-enable font-lock-mode
>                           ; again.
> 6. M-x highlight-regexp (or M-s h r) RET foo RET hi-yellow RET
> => Now "foo" is highlighted, and deleting a letter from it unhighlights
>    it.

This seems to be the documented behaviour for highlight-regexp.  Since
there's nothing more to do here, and it was already tagged notabug,
I'm closing this bug report.  If anyone disagrees, feel free to
re-open.

Thanks,
Stefan Kangas





reply via email to

[Prev in Thread] Current Thread [Next in Thread]