Mercurial > emacs
diff lisp/view.el @ 107897:1721e4658521
Test for special mode-class in view-buffer instead of view-file (bug#5513).
* view.el (view-file, view-buffer): Move test for special mode-class
from view-file to view-buffer.
* tar-mode.el (tar-extract): Turn if's into one cond
like in arc-mode.el.
author | Juri Linkov <juri@jurta.org> |
---|---|
date | Mon, 19 Apr 2010 02:49:58 +0300 |
parents | 904ccd8f2acb |
children | 0b37f86b040e |
line wrap: on
line diff
--- a/lisp/view.el Mon Apr 19 02:08:52 2010 +0300 +++ b/lisp/view.el Mon Apr 19 02:49:58 2010 +0300 @@ -262,13 +262,7 @@ (unless (file-exists-p file) (error "%s does not exist" file)) (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-if-not-modified))))) + (view-buffer buffer (and (not had-a-buf) 'kill-buffer-if-not-modified)))) ;;;###autoload (defun view-file-other-window (file) @@ -334,10 +328,16 @@ Exiting View mode will then discard the user's edits. Setting EXIT-ACTION to `kill-buffer-if-not-modified' avoids this." (interactive "bView buffer: ") - (let ((undo-window (list (window-buffer) (window-start) (window-point)))) - (switch-to-buffer buffer) - (view-mode-enter (cons (selected-window) (cons nil undo-window)) - exit-action))) + (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")) + (let ((undo-window (list (window-buffer) (window-start) (window-point)))) + (switch-to-buffer buffer) + (view-mode-enter (cons (selected-window) (cons nil undo-window)) + exit-action)))) ;;;###autoload (defun view-buffer-other-window (buffer &optional not-return exit-action)