Make the font-lock variables buffer-local instead of binding them to avoid warnings.
authorLars Magne Ingebrigtsen <larsi@stories.gnus.org>
Mon, 21 Nov 2011 19:37:19 +0000 (20:37 +0100)
committerLars Magne Ingebrigtsen <larsi@stories.gnus.org>
Mon, 21 Nov 2011 19:37:19 +0000 (20:37 +0100)
Also demote errors (bug#10063).

lisp/ChangeLog
lisp/mm-view.el

index 43a90a6..413edc2 100644 (file)
@@ -1,3 +1,9 @@
+2011-11-21  Lars Magne Ingebrigtsen  <larsi@gnus.org>
+
+       * mm-view.el (mm-display-inline-fontify): Make the font-lock variables
+       buffer-local instead of binding them to avoid warnings.  Also demote
+       errors (bug#10063).
+
 2011-11-20  Juanma Barranquero  <lekktu@gmail.com>
 
        * mm-util.el (mm-charset-after):
index 6358e34..338aa10 100644 (file)
@@ -597,25 +597,25 @@ If MODE is not set, try to find mode automatically."
                    (t
                     text)))
       (require 'font-lock)
-      (let ((font-lock-maximum-size nil)
-           ;; Disable support modes, e.g., jit-lock, lazy-lock, etc.
-           (font-lock-mode-hook nil)
-           (font-lock-support-mode nil)
-           ;; I find font-lock a bit too verbose.
-           (font-lock-verbose nil))
+      ;; I find font-lock a bit too verbose.
+      (let ((font-lock-verbose nil))
+       ;; Disable support modes, e.g., jit-lock, lazy-lock, etc.
+       (set (make-local-variable 'font-lock-mode-hook) nil)
+       (set (make-local-variable 'font-lock-support-mode) nil)
         (setq buffer-file-name (mm-handle-filename handle))
         (set (make-local-variable 'enable-local-variables) nil)
-        (if mode
-            (funcall mode)
-         (let ((auto-mode-alist
-                (delq (rassq 'doc-view-mode-maybe auto-mode-alist)
-                      (copy-sequence auto-mode-alist))))
-           (set-auto-mode)))
-       ;; The mode function might have already turned on font-lock.
-        ;; Do not fontify if the guess mode is fundamental.
-       (unless (or (symbol-value 'font-lock-mode)
-                    (eq major-mode 'fundamental-mode))
-         (font-lock-fontify-buffer)))
+       (with-demoted-errors
+         (if mode
+             (funcall mode)
+           (let ((auto-mode-alist
+                  (delq (rassq 'doc-view-mode-maybe auto-mode-alist)
+                        (copy-sequence auto-mode-alist))))
+             (set-auto-mode)))
+         ;; The mode function might have already turned on font-lock.
+         ;; Do not fontify if the guess mode is fundamental.
+         (unless (or (symbol-value 'font-lock-mode)
+                     (eq major-mode 'fundamental-mode))
+           (font-lock-fontify-buffer))))
       ;; By default, XEmacs font-lock uses non-duplicable text
       ;; properties.  This code forces all the text properties
       ;; to be copied along with the text.