# HG changeset patch # User Chong Yidong # Date 1286597359 14400 # Node ID e0fba251c544426e077e3653b41b8a29a31353eb # Parent a134abd5208858bb1bb1bce0651d06bbeca7e6f5 Fix hi-lock-mode interactions with font-lock. * hi-lock.el (hi-lock-font-lock-hook): Check font-lock-fontified instead of font-lock-mode before adding keywords. Removed hi-lock-mode off code. Removed inhibit hack. (hi-lock-set-pattern): Only add keywords if font-lock-fontified non-nil; removed hook inhibit hack. diff -r a134abd52088 -r e0fba251c544 lisp/ChangeLog --- a/lisp/ChangeLog Fri Oct 08 17:44:53 2010 -0700 +++ b/lisp/ChangeLog Sat Oct 09 00:09:19 2010 -0400 @@ -1,3 +1,11 @@ +2010-10-05 David Koppelman + + * hi-lock.el (hi-lock-font-lock-hook): Check font-lock-fontified + instead of font-lock-mode before adding keywords. Removed + hi-lock-mode off code. Removed inhibit hack. + (hi-lock-set-pattern): Only add keywords if font-lock-fontified + non-nil; removed hook inhibit hack. + 2010-10-09 Glenn Morris * emacs-lisp/shadow.el (find-emacs-lisp-shadows): Rename it... diff -r a134abd52088 -r e0fba251c544 lisp/hi-lock.el --- a/lisp/hi-lock.el Fri Oct 08 17:44:53 2010 -0700 +++ b/lisp/hi-lock.el Sat Oct 09 00:09:19 2010 -0400 @@ -564,23 +564,15 @@ 'face-name-history (cdr hi-lock-face-defaults)))) -(defvar hi-lock--inhibit-font-lock-hook nil - "Inhibit the action of `hi-lock-font-lock-hook'. -This is used by `hi-lock-set-pattern'.") - (defun hi-lock-set-pattern (regexp face) "Highlight REGEXP with face FACE." - (let ((pattern (list regexp (list 0 (list 'quote face) t))) - ;; The call to `font-lock-add-keywords' below might disable - ;; and re-enable font-lock mode. If so, we don't want - ;; `hi-lock-font-lock-hook' to run. This can be removed once - ;; Bug#635 is fixed. -- cyd - (hi-lock--inhibit-font-lock-hook t)) + (let ((pattern (list regexp (list 0 (list 'quote face) t)))) (unless (member pattern hi-lock-interactive-patterns) - (font-lock-add-keywords nil (list pattern) t) (push pattern hi-lock-interactive-patterns) (if font-lock-fontified - (font-lock-fontify-buffer) + (progn + (font-lock-add-keywords nil (list pattern) t) + (font-lock-fontify-buffer)) (let* ((serial (hi-lock-string-serialize regexp)) (range-min (- (point) (/ hi-lock-highlight-range 2))) (range-max (+ (point) (/ hi-lock-highlight-range 2))) @@ -641,12 +633,9 @@ (defun hi-lock-font-lock-hook () "Add hi-lock patterns to font-lock's." - (unless hi-lock--inhibit-font-lock-hook - (if font-lock-mode - (progn - (font-lock-add-keywords nil hi-lock-file-patterns t) - (font-lock-add-keywords nil hi-lock-interactive-patterns t)) - (hi-lock-mode -1)))) + (when font-lock-fontified + (font-lock-add-keywords nil hi-lock-file-patterns t) + (font-lock-add-keywords nil hi-lock-interactive-patterns t))) (defvar hi-lock-string-serialize-hash (make-hash-table :test 'equal)