diff options
| author | Richard M. Stallman | 2003-07-09 16:16:54 +0000 |
|---|---|---|
| committer | Richard M. Stallman | 2003-07-09 16:16:54 +0000 |
| commit | 90bb2ff45312d2e97571ca45a4fffd1a7ce8f2fd (patch) | |
| tree | 6297d88304ba7468b8aa88a0d15c94c074114da8 /lisp/view.el | |
| parent | e2cf2d72a2090569726d604da2b9a4987524989f (diff) | |
| download | emacs-90bb2ff45312d2e97571ca45a4fffd1a7ce8f2fd.tar.gz emacs-90bb2ff45312d2e97571ca45a4fffd1a7ce8f2fd.zip | |
(view-file): If existing buffer's major mode is special,
don't go into view mode.
Diffstat (limited to 'lisp/view.el')
| -rw-r--r-- | lisp/view.el | 12 |
1 files 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. | |||
| 243 | This command runs the normal hook `view-mode-hook'." | 243 | This command runs the normal hook `view-mode-hook'." |
| 244 | (interactive "fView file: ") | 244 | (interactive "fView file: ") |
| 245 | (unless (file-exists-p file) (error "%s does not exist" file)) | 245 | (unless (file-exists-p file) (error "%s does not exist" file)) |
| 246 | (let ((had-a-buf (get-file-buffer file))) | 246 | (let ((had-a-buf (get-file-buffer file)) |
| 247 | (view-buffer (find-file-noselect file) | 247 | (buffer (find-file-noselect file))) |
| 248 | (and (not had-a-buf) 'kill-buffer)))) | 248 | (if (eq (with-current-buffer buffer |
| 249 | (get major-mode 'mode-class)) | ||
| 250 | 'special) | ||
| 251 | (progn | ||
| 252 | (switch-to-buffer buffer) | ||
| 253 | (message "Not using View mode because the major mode is special")) | ||
| 254 | (view-buffer buffer (and (not had-a-buf) 'kill-buffer))))) | ||
| 249 | 255 | ||
| 250 | ;;;###autoload | 256 | ;;;###autoload |
| 251 | (defun view-file-other-window (file) | 257 | (defun view-file-other-window (file) |