bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#13891: 24.3.50; highlight-regexp incorrectly retains partial state a


From: Jambunathan K
Subject: bug#13891: 24.3.50; highlight-regexp incorrectly retains partial state after buffer reversion
Date: Thu, 04 Apr 2013 21:16:32 +0530
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux)

>> `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. 

=== 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)

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

reply via email to

[Prev in Thread] Current Thread [Next in Thread]