Mercurial > emacs
comparison lisp/view.el @ 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 | 463499edca88 |
children | 695cf19ef79e |
comparison
equal
deleted
inserted
replaced
51847:1415d5164b81 | 51848:2ec7d96e306e |
---|---|
241 For list of all View commands, type H or h while viewing. | 241 For list of all View commands, type H or h while viewing. |
242 | 242 |
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) |
252 "View FILE in View mode in another window. | 258 "View FILE in View mode in another window. |
253 Return that window to its previous buffer when done. | 259 Return that window to its previous buffer when done. |