Fix the last change.
[riece] / lisp / riece-highlight.el
index eb23ff5..b5afa46 100644 (file)
@@ -28,6 +28,7 @@
 (require 'riece-options)               ;riece-channel-list-buffer-mode
 (require 'riece-identity)              ;riece-format-identity
 (require 'font-lock)
+(require 'derived)
 
 (defgroup riece-highlight nil
   "Highlight IRC buffers"
 (defun riece-highlight-setup-dialogue ()
   (make-local-variable 'font-lock-defaults)
   (setq font-lock-defaults '(riece-dialogue-font-lock-keywords t))
+  ;; In XEmacs, auto-initialization of font-lock is not affective
+  ;; when buffer-file-name is not set.
+  (font-lock-set-defaults)
   (make-local-hook 'after-change-functions)
   (add-hook 'after-change-functions
-           'riece-highlight-hide-prefix nil 'local))
+           'riece-highlight-hide-prefix nil 'local)
+  (if riece-highlight-enabled
+      (font-lock-mode 1)))
 
 (defun riece-highlight-setup-channel-list ()
   (make-local-variable 'font-lock-defaults)
-  (setq font-lock-defaults '(riece-channel-list-font-lock-keywords t)))
+  (setq font-lock-defaults '(riece-channel-list-font-lock-keywords t))
+  ;; In XEmacs, auto-initialization of font-lock is not affective
+  ;; when buffer-file-name is not set.
+  (font-lock-set-defaults)
+  (if riece-highlight-enabled
+      (font-lock-mode 1)))
 
 (defun riece-highlight-hide-prefix (start end length)
   (save-excursion
                 major-mode))
                '(riece-dialogue-mode riece-channel-list-mode))
          (with-current-buffer (car buffers)
-           (font-lock-mode -1)))
+           (font-lock-mode 0)))
       (setq buffers (cdr buffers))))
   (setq riece-highlight-enabled nil))