summaryrefslogtreecommitdiff
path: root/lisp/view.el
diff options
context:
space:
mode:
authorJuri Linkov <juri@jurta.org>2010-04-19 02:49:58 +0300
committerJuri Linkov <juri@jurta.org>2010-04-19 02:49:58 +0300
commitfd5c9dfa9e667a980e52e1f390e817f7133ca961 (patch)
tree29f3b1a84ff9e04eb4c798f90bde038b3e6421cd /lisp/view.el
parentb3671a51b9fd296d311227150891f02f49af9017 (diff)
downloademacs-fd5c9dfa9e667a980e52e1f390e817f7133ca961.tar.gz
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.
Diffstat (limited to 'lisp/view.el')
-rw-r--r--lisp/view.el22
1 files changed, 11 insertions, 11 deletions
diff --git a/lisp/view.el b/lisp/view.el
index 63db3452a87..7493f641b6c 100644
--- a/lisp/view.el
+++ b/lisp/view.el
@@ -262,13 +262,7 @@ This command runs the normal hook `view-mode-hook'."
(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 @@ file: Users may suspend viewing in order to modify the buffer.
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)