summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Koppelman <koppel@ece.lsu.edu>2010-10-09 00:09:19 -0400
committerChong Yidong <cyd@stupidchicken.com>2010-10-09 00:09:19 -0400
commiteada408209d0407bbd107f3bedb9e60207cb3b46 (patch)
treed589171f37da8932525d9f3b1836c14b2f87dbb1
parentcfdc98ce47a4410bb3c537c1f17f37f0963663e1 (diff)
downloademacs-eada408209d0407bbd107f3bedb9e60207cb3b46.tar.gz
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.
-rw-r--r--lisp/ChangeLog8
-rw-r--r--lisp/hi-lock.el25
2 files changed, 15 insertions, 18 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 850168c4533..af1ff51edbd 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,11 @@
+2010-10-05 David Koppelman <koppel@ece.lsu.edu>
+
+ * 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 <rgm@gnu.org>
* emacs-lisp/shadow.el (find-emacs-lisp-shadows): Rename it...
diff --git a/lisp/hi-lock.el b/lisp/hi-lock.el
index de4e2ff0dfd..0273de14edd 100644
--- a/lisp/hi-lock.el
+++ b/lisp/hi-lock.el
@@ -564,23 +564,15 @@ not suitable."
'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 @@ This is used by `hi-lock-set-pattern'.")
(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)