emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] /srv/bzr/emacs/trunk r99935: Test for special mode-class i


From: Juri Linkov
Subject: [Emacs-diffs] /srv/bzr/emacs/trunk r99935: Test for special mode-class in view-buffer instead of view-file (bug#5513).
Date: Mon, 19 Apr 2010 02:49:58 +0300
User-agent: Bazaar (2.0.3)

------------------------------------------------------------
revno: 99935
committer: Juri Linkov <address@hidden>
branch nick: trunk
timestamp: Mon 2010-04-19 02:49:58 +0300
message:
  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.
modified:
  etc/NEWS
  lisp/ChangeLog
  lisp/arc-mode.el
  lisp/tar-mode.el
  lisp/view.el
=== modified file 'etc/NEWS'
--- a/etc/NEWS  2010-04-18 23:08:52 +0000
+++ b/etc/NEWS  2010-04-18 23:49:58 +0000
@@ -148,6 +148,8 @@
 
 * 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.
 

=== modified file 'lisp/ChangeLog'
--- a/lisp/ChangeLog    2010-04-18 23:08:52 +0000
+++ b/lisp/ChangeLog    2010-04-18 23:49:58 +0000
@@ -1,5 +1,15 @@
 2010-04-18  Juri Linkov  <address@hidden>
 
+       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  <address@hidden>
+
        Add 7z archive format support (bug#5475).
 
        * arc-mode.el (archive-zip-extract): Try to find 7z executable.

=== modified file 'lisp/arc-mode.el'
--- a/lisp/arc-mode.el  2010-04-18 23:08:52 +0000
+++ b/lisp/arc-mode.el  2010-04-18 23:49:58 +0000
@@ -1062,8 +1062,8 @@
        (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))))))

=== modified file 'lisp/tar-mode.el'
--- a/lisp/tar-mode.el  2010-01-13 08:35:10 +0000
+++ b/lisp/tar-mode.el  2010-04-18 23:49:58 +0000
@@ -852,14 +852,12 @@
           (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 ()

=== modified file 'lisp/view.el'
--- a/lisp/view.el      2010-03-12 17:47:22 +0000
+++ b/lisp/view.el      2010-04-18 23:49:58 +0000
@@ -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)


reply via email to

[Prev in Thread] Current Thread [Next in Thread]