summaryrefslogtreecommitdiff
path: root/lisp/view.el
diff options
context:
space:
mode:
authorChong Yidong <cyd@gnu.org>2012-02-01 16:31:29 +0800
committerChong Yidong <cyd@gnu.org>2012-02-01 16:31:29 +0800
commite2cef717da50fcb5c1e3a58b35b34dc13a5f3fb1 (patch)
tree5329eebebe4271b7f2733f01ea03ea8882688f13 /lisp/view.el
parent9f5626684300af96cca5c2f86c377d93173e4cab (diff)
downloademacs-e2cef717da50fcb5c1e3a58b35b34dc13a5f3fb1.tar.gz
Fix view-buffer-other-window/frame handling of special modes.
* view.el (view-buffer-other-window, view-buffer-other-frame): Handle special modes like view-buffer. (view-buffer): Simplify. Fixes: debbugs:10650
Diffstat (limited to 'lisp/view.el')
-rw-r--r--lisp/view.el18
1 files changed, 9 insertions, 9 deletions
diff --git a/lisp/view.el b/lisp/view.el
index 035f8c61d9f..4a219971097 100644
--- a/lisp/view.el
+++ b/lisp/view.el
@@ -311,13 +311,9 @@ 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: ")
- (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"))
- (switch-to-buffer buffer)
+ (switch-to-buffer buffer)
+ (if (eq (get major-mode 'mode-class) 'special)
+ (message "Not using View mode because the major mode is special")
(view-mode-enter nil exit-action)))
;;;###autoload
@@ -339,7 +335,9 @@ this argument instead of explicitly setting `view-exit-action'."
(interactive "bIn other window view buffer:\nP")
(let ((pop-up-windows t))
(pop-to-buffer buffer t))
- (view-mode-enter nil exit-action))
+ (if (eq (get major-mode 'mode-class) 'special)
+ (message "Not using View mode because the major mode is special")
+ (view-mode-enter nil exit-action)))
;;;###autoload
(defun view-buffer-other-frame (buffer &optional not-return exit-action)
@@ -360,7 +358,9 @@ this argument instead of explicitly setting `view-exit-action'."
(interactive "bView buffer in other frame: \nP")
(let ((pop-up-frames t))
(pop-to-buffer buffer t))
- (view-mode-enter nil exit-action))
+ (if (eq (get major-mode 'mode-class) 'special)
+ (message "Not using View mode because the major mode is special")
+ (view-mode-enter nil exit-action)))
;;;###autoload
(define-minor-mode view-mode