From 90bb2ff45312d2e97571ca45a4fffd1a7ce8f2fd Mon Sep 17 00:00:00 2001 From: "Richard M. Stallman" Date: Wed, 9 Jul 2003 16:16:54 +0000 Subject: [PATCH] (view-file): If existing buffer's major mode is special, don't go into view mode. --- lisp/view.el | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/lisp/view.el b/lisp/view.el index 2ef84d23510..281230950bc 100644 --- a/lisp/view.el +++ b/lisp/view.el @@ -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) -- 2.39.2