GNU bug report logs -
#1702
feature request: correctly display single file zip archive
Previous Next
Reported by: xah lee <xah <at> xahlee.org>
Date: Thu, 25 Dec 2008 18:40:04 UTC
Severity: wishlist
Done: Eli Zaretskii <eliz <at> gnu.org>
Bug is archived. No further changes may be made.
Full log
View this message in rfc822 format
[Message part 1 (text/plain, inline)]
Hi all,
xah lee <xah <at> xahlee.org> writes:
> When opening a zip archive of a single file, emacs displays the zip
> archive's index (which is just a single file), as opposed to the
> decompressed file content.
>
> I think when the zip file is a single file, it is more useful to
> display file content and allow transparent editing.
Please see the attached patch to implement this.
Any comments welcome!
Thanks,
--
Matt
ChangeLog entry:
2014-11-13 Matthew Leach <matthew <at> mattleach.net>
* arc-mode.el (singular-file-archive-action): New.
(archive-mode): Visit file if archive contains a single file.
[0001-Don-t-show-summary-for-single-file-archives.patch (text/x-diff, inline)]
From 1c84ec04f024f9de44b0bb57d60d009b9738c899 Mon Sep 17 00:00:00 2001
From: Matthew Leach <matthew <at> mattleach.net>
Date: Thu, 13 Nov 2014 18:30:24 +0000
Subject: [PATCH] Don't show summary for single-file archives.
* arc-mode.el (singular-file-archive-action): New.
(archive-mode): Visit file if archive contains a single file.
---
lisp/arc-mode.el | 14 +++++++++++++-
1 file changed, 13 insertions(+), 1 deletion(-)
diff --git a/lisp/arc-mode.el b/lisp/arc-mode.el
index ef155ee..279b9a1 100644
--- a/lisp/arc-mode.el
+++ b/lisp/arc-mode.el
@@ -147,6 +147,13 @@ 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 singular-file-archive-action 'visit-file
+ "When opening an archive that contains a single file choose
+whether to open the file or display the archive summary."
+ :type '(choice (const :tag "Show archive summary" show-summary)
+ (const :tag "Visit the single file" visit-file))
+ :group 'archive)
;; ------------------------------
;; Arc archive configuration
@@ -742,7 +749,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 (= (length archive-files) 1)
+ (eq singular-file-archive-action 'visit-file))
+ (let ((archive-buffer (current-buffer)))
+ (archive-extract)
+ (kill-buffer archive-buffer))))))
;; Archive mode is suitable only for specially formatted data.
(put 'archive-mode 'mode-class 'special)
--
2.1.3
This bug report was last modified 10 years and 264 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.