From: Eli Zaretskii <eliz@gnu.org>
To: Dima Kogan <dima@secretsauce.net>
Cc: 57534@debbugs.gnu.org
Subject: bug#57534: 29.0.50; Highlighting lost after auto-revert-mode triggers
Date: Fri, 02 Sep 2022 09:10:30 +0300 [thread overview]
Message-ID: <83fshaqpbd.fsf@gnu.org> (raw)
In-Reply-To: <87o7vyhg72.fsf@shorty.mail-host-address-is-not-set> (message from Dima Kogan on Thu, 01 Sep 2022 15:40:01 -0700)
> From: Dima Kogan <dima@secretsauce.net>
> Date: Thu, 01 Sep 2022 15:40:01 -0700
>
> Hi. I'm seeing this:
>
> 1. seq 10 > /tmp/file
>
> 2. emacs -Q /tmp/file
This "file" is in Fundamental mode, yes? If not, which major mode is
used, and does that major mode turns on Font Lock?
> 3. (highlight-lines-matching-regexp "3")
>
> This is bound to "M-s h l". I see the line containing "3" highlighted
> in yellow, as expected
>
> 4. M-x auto-revert-mode
>
> 5. Back in the shell: seq 20 > /tmp/file
>
>
> auto-revert-mode kicks in, updating the buffer with the results of 'seq
> 20' (possibly updating to an empty buffer first, if we react immediately
> to the file truncation). At this point I would expect either:
>
> 1. The buffer being fully reverted, with all the highlighting
> disappearing. This is what happens if we did M-x revert buffer
>
> 2. The buffer contents being reverted, but the highlighting being
> reapplied
>
> In this auto-revert scenario, we get something in-between: after the
> auto-revert hi-lock-interactive-patterns still contains the highlighting
> regex, but no highlighting actually happens. It'd be really nice and
> useful if the highlighting stayed.
The documentation of hi-lock-mode says:
In buffers where Font Lock mode is enabled, patterns are
highlighted using font lock. In buffers where Font Lock mode is
disabled, patterns are applied using overlays; in this case, the
highlighting will not be updated as you type. The Font Lock mode
is considered \"enabled\" in a buffer if its `major-mode'
causes `font-lock-specified-p' to return non-nil, which means
the major mode specifies support for Font Lock.
If I use your recipe in a file visited with C Mode, which does use
Font Lock, the auto-revert doesn't lose the highlighted lines.
next prev parent reply other threads:[~2022-09-02 6:10 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-09-01 22:40 bug#57534: 29.0.50; Highlighting lost after auto-revert-mode triggers Dima Kogan
2022-09-02 6:10 ` Eli Zaretskii [this message]
2022-09-02 7:04 ` Juri Linkov
2022-09-02 7:22 ` Eli Zaretskii
2022-09-02 14:27 ` Drew Adams
2024-06-25 6:52 ` Juri Linkov
2024-06-27 6:52 ` Juri Linkov
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=83fshaqpbd.fsf@gnu.org \
--to=eliz@gnu.org \
--cc=57534@debbugs.gnu.org \
--cc=dima@secretsauce.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.