]> git.eshelyaron.com Git - emacs.git/commitdiff
Test for special mode-class in view-buffer instead of view-file (bug#5513).
authorJuri Linkov <juri@jurta.org>
Sun, 18 Apr 2010 23:49:58 +0000 (02:49 +0300)
committerJuri Linkov <juri@jurta.org>
Sun, 18 Apr 2010 23:49:58 +0000 (02:49 +0300)
* 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.

etc/NEWS
lisp/ChangeLog
lisp/arc-mode.el
lisp/tar-mode.el
lisp/view.el

index 74f1eb5f660bd2d4c97f32e6e74c1542c501d32a..b47fcd09536d1d631c08938133edf8f41b970d45 100644 (file)
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -148,6 +148,8 @@ Secret Service API requires D-Bus for communication.
 \f
 * Incompatible Lisp Changes in Emacs 24.1
 
+** Test for special mode-class was moved from view-file to view-buffer.
+
 ** Passing a nil argument to a minor mode function now turns the mode
    ON unconditionally.
 \f
index 45ebef6cec0a6dcee18ef6893fbdcbc3a0fe171f..8b9fef8bb0880c81085174ead2e548689bd426d7 100644 (file)
@@ -1,3 +1,13 @@
+2010-04-18  Juri Linkov  <juri@jurta.org>
+
+       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.
+
 2010-04-18  Juri Linkov  <juri@jurta.org>
 
        Add 7z archive format support (bug#5475).
index 059489c999765024f800fbf8734b0c002da9af57..fb6155dfd41e3feaa4b4df3fad7061d2bdbd62f5 100644 (file)
@@ -1062,8 +1062,8 @@ using `make-temp-file', and the generated name is returned."
        (archive-maybe-update t))
       (or (not (buffer-name buffer))
           (cond
-           (view-p (view-buffer
-                   buffer (and just-created 'kill-buffer-if-not-modified)))
+           (view-p
+           (view-buffer buffer (and just-created 'kill-buffer-if-not-modified)))
            ((eq other-window-p 'display) (display-buffer buffer))
            (other-window-p (switch-to-buffer-other-window buffer))
            (t (switch-to-buffer buffer))))))
index be9af8e293d1b34f24763379d2b03bb7375fa5b6..f892570633729ac4376ce6423193b2a9c0b32ab3 100644 (file)
@@ -852,14 +852,12 @@ appear on disk when you save the tar-file's buffer."
           (set (make-local-variable 'tar-superior-descriptor) descriptor)
           (setq buffer-read-only read-only-p)
           (tar-subfile-mode 1)))
-      (if view-p
-         (view-buffer
-          buffer (and just-created 'kill-buffer-if-not-modified))
-       (if (eq other-window-p 'display)
-           (display-buffer buffer)
-         (if other-window-p
-             (switch-to-buffer-other-window buffer)
-           (switch-to-buffer buffer)))))))
+      (cond
+       (view-p
+       (view-buffer buffer (and just-created 'kill-buffer-if-not-modified)))
+       ((eq other-window-p 'display) (display-buffer buffer))
+       (other-window-p (switch-to-buffer-other-window buffer))
+       (t (switch-to-buffer buffer))))))
 
 
 (defun tar-extract-other-window ()
index 63db3452a87179a82939ee12ad836cab479afb7e..7493f641b6ccaf85860da427ae0183784fc00ea0 100644 (file)
@@ -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)