[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: hi-lock-mode doesn't work with emacs -Q.
From: |
Stefan Monnier |
Subject: |
Re: hi-lock-mode doesn't work with emacs -Q. |
Date: |
Mon, 11 Jun 2007 16:25:14 -0400 |
User-agent: |
Gnus/5.11 (Gnus v5.11) Emacs/22.1.50 (gnu/linux) |
> . Enable hi-lock-mode and make "foo" a highlightable pattern:
> M-x hi-lock-mode
> C-x w h foo<CR><CR> ; accept the default hi-yellow face.
> . This highlights the "foo" yellow, as expected. At the end of the
> line, type:
> foo
> . This new "foo" doesn't get highlighted. It should be.
I believe the patch below fixes the problem without making things worse and
without requiring changes to hi-lock.el.
Stefan
--- font-lock.el 08 May 2007 11:55:52 -0400 1.317
+++ font-lock.el 11 Jun 2007 15:56:01 -0400
@@ -698,6 +698,14 @@
;; contain the new keywords.
(font-lock-update-removed-keyword-alist mode keywords how))
(t
+ (when (and font-lock-mode
+ (not (or font-lock-keywords font-lock-defaults)))
+ ;; The major mode has not set any keywords, so when we enabled
+ ;; font-lock-mode it only enabled the font-core.el part, not the
+ ;; font-lock-mode-internal. Try again.
+ (font-lock-mode -1)
+ (set (make-local-variable 'font-lock-defaults) '(nil t))
+ (font-lock-mode 1))
;; Otherwise set or add the keywords now.
;; This is a no-op if it has been done already in this buffer
;; for the correct major mode.