Commit 90bb2ff4 authored by Richard M. Stallman's avatar Richard M. Stallman
Browse files

(view-file): If existing buffer's major mode is special,

don't go into view mode.
parent e2cf2d72
......@@ -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)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment