[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#5513: Archives disregard special mode-class
From: |
Juri Linkov |
Subject: |
bug#5513: Archives disregard special mode-class |
Date: |
Wed, 03 Feb 2010 01:27:46 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/23.1.92 (x86_64-pc-linux-gnu) |
Visiting a file from an archive activates view-mode even when its major
mode has the property `mode-class' equal to `special'. For instance,
visiting a .jar archive from .xpi archives or from .tar archives.
(See also bug#4896 for more information.)
This patch takes into account the special mode-class property
and doesn't activate view-mode in this case:
=== modified file 'lisp/arc-mode.el'
--- lisp/arc-mode.el 2010-02-01 23:02:47 +0000
+++ lisp/arc-mode.el 2010-02-02 23:10:14 +0000
@@ -1057,8 +1057,16 @@ (defun archive-extract (&optional other-
(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
+ ;; FIXME: code duplicated from `view-file', perhaps the test for
special
+ ;; mode-class should be moved from `view-file' to `view-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"))
+ (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'
--- lisp/tar-mode.el 2010-01-13 08:35:10 +0000
+++ lisp/tar-mode.el 2010-01-31 20:06:55 +0000
@@ -852,14 +852,23 @@ (defun tar-extract (&optional other-wind
(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
+ ;; FIXME: code duplicated from `view-file', perhaps the test for special
+ ;; mode-class should be moved from `view-file' to `view-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"))
+ (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 ()
--
Juri Linkov
http://www.jurta.org/emacs/
- bug#5513: Archives disregard special mode-class,
Juri Linkov <=