]> git.eshelyaron.com Git - emacs.git/commitdiff
(view-file): If existing buffer's major mode is special,
authorRichard M. Stallman <rms@gnu.org>
Wed, 9 Jul 2003 16:16:54 +0000 (16:16 +0000)
committerRichard M. Stallman <rms@gnu.org>
Wed, 9 Jul 2003 16:16:54 +0000 (16:16 +0000)
don't go into view mode.

lisp/view.el

index 2ef84d2351071838a92ebb95a555f6bcc9aae264..281230950bcff0b60c61c6e6ac669a03c3cdda95 100644 (file)
@@ -243,9 +243,15 @@ For list of all View commands, type H or h while viewing.
 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)