aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lisp/gnus/mm-view.el31
1 files changed, 17 insertions, 14 deletions
diff --git a/lisp/gnus/mm-view.el b/lisp/gnus/mm-view.el
index 8ce094349f2..1e1d264b994 100644
--- a/lisp/gnus/mm-view.el
+++ b/lisp/gnus/mm-view.el
@@ -476,29 +476,32 @@ If MODE is not set, try to find mode automatically."
476 (mm-decode-string text charset)) 476 (mm-decode-string text charset))
477 (t 477 (t
478 text))) 478 text)))
479 (require 'font-lock) 479 (let ((font-lock-verbose nil) ; font-lock is a bit too verbose.
480 ;; I find font-lock a bit too verbose.
481 (let ((font-lock-verbose nil)
482 (font-lock-support-mode nil)
483 (enable-local-variables nil)) 480 (enable-local-variables nil))
484 ;; Disable support modes, e.g., jit-lock, lazy-lock, etc. 481 ;; We used to set font-lock-mode-hook to nil to avoid enabling
485 ;; Note: XEmacs people use `font-lock-mode-hook' to run those modes. 482 ;; support modes, but now that we use font-lock-ensure, support modes
483 ;; aren't a problem any more. So we could probably get rid of this
484 ;; setting now, but it seems harmless and potentially still useful.
486 (set (make-local-variable 'font-lock-mode-hook) nil) 485 (set (make-local-variable 'font-lock-mode-hook) nil)
487 (setq buffer-file-name (mm-handle-filename handle)) 486 (setq buffer-file-name (mm-handle-filename handle))
488 (with-demoted-errors 487 (with-demoted-errors
489 (if mode 488 (if mode
490 (save-window-excursion 489 (save-window-excursion
491 (switch-to-buffer (current-buffer)) 490 ;; According to Katsumi Yamaoka <yamaoka@jpl.org>, org-mode
492 (funcall mode)) 491 ;; requires the buffer to be temporarily displayed here, but
492 ;; I could not reproduce this problem. Furthermore, if
493 ;; there's such a problem, we should fix org-mode rather than
494 ;; use switch-to-buffer which can have undesirable
495 ;; side-effects!
496 ;;(switch-to-buffer (current-buffer))
497 (funcall mode))
493 (let ((auto-mode-alist 498 (let ((auto-mode-alist
494 (delq (rassq 'doc-view-mode-maybe auto-mode-alist) 499 (delq (rassq 'doc-view-mode-maybe auto-mode-alist)
495 (copy-sequence auto-mode-alist)))) 500 (copy-sequence auto-mode-alist))))
496 (set-auto-mode) 501 (set-auto-mode)
497 (setq mode major-mode))) 502 (setq mode major-mode)))
498 ;; The mode function might have already turned on font-lock.
499 ;; Do not fontify if the guess mode is fundamental. 503 ;; Do not fontify if the guess mode is fundamental.
500 (unless (or font-lock-mode 504 (unless (eq major-mode 'fundamental-mode)
501 (eq major-mode 'fundamental-mode))
502 (font-lock-ensure)))) 505 (font-lock-ensure))))
503 (setq text (buffer-string)) 506 (setq text (buffer-string))
504 (when (eq mode 'diff-mode) 507 (when (eq mode 'diff-mode)
@@ -508,7 +511,7 @@ If MODE is not set, try to find mode automatically."
508 ;; Set buffer unmodified to avoid confirmation when killing the 511 ;; Set buffer unmodified to avoid confirmation when killing the
509 ;; buffer. 512 ;; buffer.
510 (set-buffer-modified-p nil)) 513 (set-buffer-modified-p nil))
511 (let ((b (1- (point)))) 514 (let ((b (- (point) (save-restriction (widen) (point-min)))))
512 (mm-insert-inline handle text) 515 (mm-insert-inline handle text)
513 (dolist (ov ovs) 516 (dolist (ov ovs)
514 (move-overlay (nth 0 ov) (+ (nth 1 ov) b) 517 (move-overlay (nth 0 ov) (+ (nth 1 ov) b)