GNU bug report logs - #13891
24.3.50; highlight-regexp incorrectly retains partial state after buffer reversion

Previous Next

Package: emacs;

Reported by: Josh <josh <at> foxtail.org>

Date: Wed, 6 Mar 2013 17:23:01 UTC

Severity: minor

Found in version 24.3.50

Done: Stefan Monnier <monnier <at> IRO.UMontreal.CA>

Bug is archived. No further changes may be made.

Full log


Message #28 received at 13891 <at> debbugs.gnu.org (full text, mbox):

From: Jambunathan K <kjambunathan <at> gmail.com>
To: Stefan Monnier <monnier <at> iro.umontreal.ca>
Cc: josh <at> foxtail.org, 13891 <at> debbugs.gnu.org
Subject: Re: bug#13891: 24.3.50;
	highlight-regexp incorrectly retains partial state after buffer
	reversion
Date: Thu, 04 Apr 2013 21:16:32 +0530
[Message part 1 (text/plain, inline)]
>> `hi-lock-interactive-patterns' as `permanent-local'.
>
> Agreed.  Even more so for hi-lock-file-patterns.

>> With `global-hi-lock-mode' ON, you will notice that highlighting will
>> be retained across reverts.
>
> Not any more after my patch.

Whether this change in behaviour counts as a regression, I am not sure.


>> 2. I think `font-lock-fontify-buffer' should be added to
>>    `hi-lock-font-lock-hook'.
>
> Why?

`hi-lock-font-lock-hook' adds the font lock keywords.
`font-lock-fontify-buffer' activates the keywords. 

>>    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'.)
>
> What was your test case?

For the sake of discussion, I undid your patch.  

Apply this patch and re-load hi-lock.el. 

[Message part 2 (text/x-diff, inline)]
=== modified file 'lisp/hi-lock.el'
--- lisp/hi-lock.el	2013-03-31 13:34:35 +0000
+++ lisp/hi-lock.el	2013-04-04 14:54:39 +0000
@@ -390,8 +390,8 @@ versions before 22 use the following in
 	  (cons "Regexp Highlighting" hi-lock-menu))
 	(hi-lock-find-patterns)
         (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))
+	(hi-lock-font-lock-hook)
+	(font-lock-fontify-buffer))
     ;; Turned off.
     (when (or hi-lock-interactive-patterns
 	      hi-lock-file-patterns)

[Message part 3 (text/plain, inline)]
1. M-s h r something
2. Modify buffer.
3. Revert buffer.
4. M-: hi-lock-interactive-patterns
   Verify that variable is non-nil.

5. M-x hi-lock-mode.  (For now do it by hand.)
6. See that highlighting kicks in.

My expectation was that once `hi-lock-mode' is turned on
`font-lock-mode-hook' will be *automatically* called.  

Is it the minor mode's responsibility to explicitly call it's
fontification handler?

>
>>    Problem area: `font-lock-mode-hook' is not documented and I really
>>    don't when it is getting called.
>
> font-lock-mode is a normal minor-mode, so font-lock-mode-hook is called
> at the end of running font-lock-mode (both to enable and to disable it).
>
>
>         Stefan

This bug report was last modified 12 years and 51 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.