[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#13891: 24.3.50; highlight-regexp incorrectly retains partial state a
bug#13891: 24.3.50; highlight-regexp incorrectly retains partial state after buffer reversion
Sun, 31 Mar 2013 21:41:12 +0530
Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux)
Stefan Monnier <address@hidden> 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
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
Problem area: `font-lock-mode-hook' is not documented and I really
don't when it is getting called.
> === 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))
> - (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