From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#57534: 29.0.50; Highlighting lost after auto-revert-mode triggers Date: Fri, 02 Sep 2022 09:10:30 +0300 Message-ID: <83fshaqpbd.fsf@gnu.org> References: <87o7vyhg72.fsf@shorty.mail-host-address-is-not-set> Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="1442"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 57534@debbugs.gnu.org To: Dima Kogan Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Fri Sep 02 08:11:15 2022 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1oTzta-0000AT-Jq for geb-bug-gnu-emacs@m.gmane-mx.org; Fri, 02 Sep 2022 08:11:14 +0200 Original-Received: from localhost ([::1]:38112 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oTztZ-0000Gk-EH for geb-bug-gnu-emacs@m.gmane-mx.org; Fri, 02 Sep 2022 02:11:13 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:52470) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oTztO-0000Gc-3w for bug-gnu-emacs@gnu.org; Fri, 02 Sep 2022 02:11:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:54881) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oTztN-0006wc-Rp for bug-gnu-emacs@gnu.org; Fri, 02 Sep 2022 02:11:01 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1oTztN-0006Ps-NA for bug-gnu-emacs@gnu.org; Fri, 02 Sep 2022 02:11:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 02 Sep 2022 06:11:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 57534 X-GNU-PR-Package: emacs Original-Received: via spool by 57534-submit@debbugs.gnu.org id=B57534.166209901224587 (code B ref 57534); Fri, 02 Sep 2022 06:11:01 +0000 Original-Received: (at 57534) by debbugs.gnu.org; 2 Sep 2022 06:10:12 +0000 Original-Received: from localhost ([127.0.0.1]:44630 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oTzsZ-0006OU-GU for submit@debbugs.gnu.org; Fri, 02 Sep 2022 02:10:11 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:53108) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oTzsX-0006OF-Qe for 57534@debbugs.gnu.org; Fri, 02 Sep 2022 02:10:10 -0400 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]:52692) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oTzsS-0006iX-Gl; Fri, 02 Sep 2022 02:10:04 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=v900qj4ktZKukaTaDaPYHGMDF1sFlpNwGCP1WLf/8fg=; b=WJuxYsCXmLPP LtaJUafvHAC7pamFdBPq5XFsOkd8ptuXXPvIWnzkA5AauFXJtNhWu8eABkM1mvwpr7mFfP3S4a4BX GjJ+XokSjny5sU4XUAFRUrSc49oFrifDhShIiODlD29h6HuRcG2EmGh+L9lMWEsCYe3lJDGsEcMe5 LiYuehs11uVxUadByRdqI+vYXIKBOobGtoPswxyvGSEw8+vCRwK7YAfodyh4EdUsiptJhj2GbGB80 ft/pqr0fYVqvndmcYeGqbrGkwpxH5nGgI//HB/2MQJ5BJLIlb/SdEeY5bYwfu2jsbZadYN41bI1uL IMDcXqicZ9vONLNntkoHHQ==; Original-Received: from [87.69.77.57] (port=4948 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oTzsP-0007qM-Cn; Fri, 02 Sep 2022 02:10:03 -0400 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) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:241288 Archived-At: > From: Dima Kogan > 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.