]> git.eshelyaron.com Git - emacs.git/commitdiff
Fix bug #1702 with missing feature in arc-mode.el.
authorMatthew Leach <matthew@mattleach.net>
Fri, 21 Nov 2014 10:08:00 +0000 (12:08 +0200)
committerEli Zaretskii <eliz@gnu.org>
Fri, 21 Nov 2014 10:08:00 +0000 (12:08 +0200)
 lisp/arc-mode.el (archive-visit-single-files): New.
 (archive-mode): Visit file if archive contains a single file.

lisp/ChangeLog
lisp/arc-mode.el

index 9d5d72746f35d64c08a16ada4ee236035d1586e4..4169e838f0e46a482e3be767ace7d6709d599853 100644 (file)
@@ -1,3 +1,9 @@
+2014-11-13  Matthew Leach  <matthew@mattleach.net>
+
+       * arc-mode.el (archive-visit-single-files): New.
+       (archive-mode): Visit file if archive contains a single file.
+       (Bug#1702)
+
 2014-11-21  Ulrich Müller  <ulm@gentoo.org>
 
        * vc/vc.el: Fix a typo in the commentary.
index a9f0ec71b5139b1d17eb4f58591ee205eb89e5e4..df04521965f9421eb20155d80d0786aa2cde04ac 100644 (file)
@@ -147,6 +147,15 @@ A local copy of the archive will be used when updating."
   "Hook run when an archive member has been extracted."
   :type 'hook
   :group 'archive)
+
+(defcustom archive-visit-single-files nil
+  "If non-nil, opening an archive with a single file visits that file.
+
+  If this option's value is nil, visiting such archives will
+  display the archive summary."
+  :type '(choice (const :tag "Visit the single file" t)
+                 (const :tag "Show the archive summary" nil))
+  :group 'archive)
 ;; ------------------------------
 ;; Arc archive configuration
 
@@ -742,7 +751,12 @@ archive.
       (if (default-value 'enable-multibyte-characters)
          (set-buffer-multibyte 'to))
       (archive-summarize nil)
-      (setq buffer-read-only t))))
+      (setq buffer-read-only t)
+      (when (and archive-visit-single-files
+                 auto-compression-mode
+                 (= (length archive-files) 1))
+        (rename-buffer (concat " " (buffer-name)))
+        (archive-extract)))))
 
 ;; Archive mode is suitable only for specially formatted data.
 (put 'archive-mode 'mode-class 'special)