changeset 51848:2ec7d96e306e

(view-file): If existing buffer's major mode is special, don't go into view mode.
author Richard M. Stallman <rms@gnu.org>
date Wed, 09 Jul 2003 16:16:54 +0000
parents 1415d5164b81
children 48ac694d29fa
files lisp/view.el
diffstat 1 files changed, 9 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/view.el	Wed Jul 09 16:15:24 2003 +0000
+++ b/lisp/view.el	Wed Jul 09 16:16:54 2003 +0000
@@ -243,9 +243,15 @@
 This command runs the normal hook `view-mode-hook'."
   (interactive "fView file: ")
   (unless (file-exists-p file) (error "%s does not exist" file))
-  (let ((had-a-buf (get-file-buffer file)))
-    (view-buffer (find-file-noselect file)
-		 (and (not had-a-buf) 'kill-buffer))))
+  (let ((had-a-buf (get-file-buffer file))
+	(buffer (find-file-noselect file)))
+    (if (eq (with-current-buffer buffer
+	      (get major-mode 'mode-class))
+	    'special)
+	(progn
+	  (switch-to-buffer buffer)
+	  (message "Not using View mode because the major mode is special"))
+      (view-buffer buffer (and (not had-a-buf) 'kill-buffer)))))
 
 ;;;###autoload
 (defun view-file-other-window (file)