From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Jambunathan K Newsgroups: gmane.emacs.bugs Subject: bug#13891: 24.3.50; highlight-regexp incorrectly retains partial state after buffer reversion Date: Sun, 31 Mar 2013 21:41:12 +0530 Message-ID: <87k3ono8gv.fsf@gmail.com> References: NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1364746339 18875 80.91.229.3 (31 Mar 2013 16:12:19 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sun, 31 Mar 2013 16:12:19 +0000 (UTC) Cc: josh@foxtail.org To: 13891@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sun Mar 31 18:12:46 2013 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1UMKsA-0005j3-16 for geb-bug-gnu-emacs@m.gmane.org; Sun, 31 Mar 2013 18:12:46 +0200 Original-Received: from localhost ([::1]:56108 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UMKrl-0000CO-Gi for geb-bug-gnu-emacs@m.gmane.org; Sun, 31 Mar 2013 12:12:21 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:34537) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UMKrh-0000C8-A9 for bug-gnu-emacs@gnu.org; Sun, 31 Mar 2013 12:12:18 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UMKrf-0004sP-RD for bug-gnu-emacs@gnu.org; Sun, 31 Mar 2013 12:12:17 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:50238) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UMKrf-0004sJ-Nm for bug-gnu-emacs@gnu.org; Sun, 31 Mar 2013 12:12:15 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.72) (envelope-from ) id 1UMKuM-0002Ic-J6 for bug-gnu-emacs@gnu.org; Sun, 31 Mar 2013 12:15:02 -0400 X-Loop: help-debbugs@gnu.org In-Reply-To: Resent-From: Jambunathan K Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 31 Mar 2013 16:15:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 13891 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 13891-submit@debbugs.gnu.org id=B13891.13647464538759 (code B ref 13891); Sun, 31 Mar 2013 16:15:02 +0000 Original-Received: (at 13891) by debbugs.gnu.org; 31 Mar 2013 16:14:13 +0000 Original-Received: from localhost ([127.0.0.1]:54347 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1UMKtZ-0002HE-3T for submit@debbugs.gnu.org; Sun, 31 Mar 2013 12:14:13 -0400 Original-Received: from mail-pb0-f51.google.com ([209.85.160.51]:35739) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1UMKtW-0002H6-7q for 13891@debbugs.gnu.org; Sun, 31 Mar 2013 12:14:11 -0400 Original-Received: by mail-pb0-f51.google.com with SMTP id rr4so840384pbb.24 for <13891@debbugs.gnu.org>; Sun, 31 Mar 2013 09:11:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=x-received:from:to:cc:subject:references:date:message-id:user-agent :mime-version:content-type; bh=PCOC/WKz0nK2tESMpEGas03yGME9ON/8Hohq1rSHYjg=; b=j8mZaVdux/poYf2z5yUHxKdEC3q+6DLtdPCaxW2LtqEwlAVLiuhxrog/Lf5qMWCUwS 9q5NBDDJ+fsQxjfz0jwGdusTIZEMc3BQWFV97pxPWzvhI2+0oxm1XxkBK+B91qf/o7nE fXRDRpjGae4UA3AXwFylcJ+F7mTS3X1QIxovfi33lSWwB0CibIaCNAOxlL6rZ24KZcuX wwAWUar3HNCMOS8G9D83qaUDfHjQJDojJCoShb0kDuZDaXmD2/ChU9Ye/hDleZJNiEqN p8a3+HNU+wyytSAHefWStlkKGjRARBBLvxHKQRXHS2p8eP2GXMMcOaPB8J0eHkkUJGlH RsZQ== X-Received: by 10.68.129.9 with SMTP id ns9mr14380525pbb.16.1364746281445; Sun, 31 Mar 2013 09:11:21 -0700 (PDT) Original-Received: from debian-6.05 ([101.62.38.214]) by mx.google.com with ESMTPS id ce16sm11690886pac.5.2013.03.31.09.11.17 (version=TLSv1.1 cipher=RC4-SHA bits=128/128); Sun, 31 Mar 2013 09:11:20 -0700 (PDT) User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 140.186.70.43 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.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:73041 Archived-At: Stefan Monnier writes: >> I noticed two things that show that partial highlight-regexp state >> lingers after calling revert-buffer, see items 9 and 12. After buffer > > I've installed the patch below which should fix those problems. (This is not a comment on the patch you have put in, but my initial thoughts as I investigated the bug.) I have a feeling that your fix is "inconsistent" with having `hi-lock-interactive-patterns' as `permanent-local'. `hi-lock-interactive-patterns' is marked as `permanent-local'. So the original intention is clearly to *retain* the highlighting across the reverts and change of major modes. With `global-hi-lock-mode' ON, you will notice that highlighting will be retained across reverts. When M-s h r is used, hi-lock-mode is turned on automatically. But after revert, the hi-lock-mode (being a minor mode) never gets turned back again. I was thinking of fix along the lines of 1. If `hi-lock-interactive-patterns' is non-nil, turn on hi-lock-mode. 2. I think `font-lock-fontify-buffer' should be added to `hi-lock-font-lock-hook'. For some reason, `hi-lock-font-lock-hook' doesn't get called at all (even though it is added to the `font-lock-mode-hook'.) Problem area: `font-lock-mode-hook' is not documented and I really don't when it is getting called. > > > Stefan > > > === modified file 'lisp/hi-lock.el' > --- lisp/hi-lock.el 2013-03-08 04:18:16 +0000 > +++ lisp/hi-lock.el 2013-03-31 13:31:41 +0000 > @@ -389,7 +389,9 @@ > (define-key-after menu-bar-edit-menu [hi-lock] > (cons "Regexp Highlighting" hi-lock-menu)) > (hi-lock-find-patterns) > - (add-hook 'font-lock-mode-hook 'hi-lock-font-lock-hook nil t)) > + (add-hook 'font-lock-mode-hook 'hi-lock-font-lock-hook nil t) > + ;; Remove regexps from font-lock-keywords (bug#13891). > + (add-hook 'change-major-mode-hook (lambda () (hi-lock-mode -1)) nil t)) > ;; Turned off. > (when (or hi-lock-interactive-patterns > hi-lock-file-patterns)