Subject: [PATCH] hi-lock: more appropriate use of font-locking
From: E Sabof <[email-masked]>
To: [email-masked]
Date: Thu, 11 Apr 2013 05:19:13 +0100
List-Id: <debbugs-submit.debbugs.gnu.org>

Most modes that use custom fontification (ex occur-mode), won't turn the
font-lock-mode off. So hi-lock would add a keyword, and remove all existing
fontification. The below patch fixes this behaviour.

Evgeni

Modified   lisp/hi-lock.el
diff --git a/lisp/hi-lock.el b/lisp/hi-lock.el
index e2dc4ea..e16ed76 100644
--- a/lisp/hi-lock.el
+++ b/lisp/hi-lock.el
@@ -689,7 +689,7 @@ Otherwise, read face name from minibuffer with
completion and history."
     ;; Refuse to highlight a text that is already highlighted.
     (unless (assoc regexp hi-lock-interactive-patterns)
       (push pattern hi-lock-interactive-patterns)
-      (if font-lock-mode
+      (if (and font-lock-mode (font-lock-specified-p major-mode))
   (progn
     (font-lock-add-keywords nil (list pattern) t)
     (font-lock-fontify-buffer))