all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Stefan Kangas <stefan@marxist.se>
To: Stephen Berman <stephen.berman@gmx.net>
Cc: Paul Whittaker <emacs@pdw.org.uk>, 25841-done@debbugs.gnu.org
Subject: bug#25841: 25.2; Highlighting not being updated in some modes.
Date: Wed, 21 Aug 2019 04:09:38 +0200	[thread overview]
Message-ID: <CADwFkmk-qE6Em==wL2Z5ECtV_KXqrg+e+m3L_ZXheamTsF9pkA@mail.gmail.com> (raw)
In-Reply-To: <231f3b41-7ba1-58d9-a1d4-2e0af37d0ac7@drisq.com>

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





      parent reply	other threads:[~2019-08-21  2:09 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-02-22 21:39 bug#25841: 25.2; Highlighting not being updated in some modes Paul Whittaker
2017-02-22 22:02 ` Glenn Morris
2017-02-23 12:21   ` Paul Whittaker
2017-02-23 15:00     ` Stephen Berman
2019-08-21  2:09 ` Stefan Kangas [this message]

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

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CADwFkmk-qE6Em==wL2Z5ECtV_KXqrg+e+m3L_ZXheamTsF9pkA@mail.gmail.com' \
    --to=stefan@marxist.se \
    --cc=25841-done@debbugs.gnu.org \
    --cc=emacs@pdw.org.uk \
    --cc=stephen.berman@gmx.net \
    /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 external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.