GNU bug report logs - #1702
feature request: correctly display single file zip archive

Previous Next

Package: emacs;

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.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 1702 in the body.
You can then email your comments to 1702 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>:
bug#1702; Package emacs. (Thu, 25 Dec 2008 18:40:04 GMT) Full text and rfc822 format available.

Acknowledgement sent to xah lee <xah <at> xahlee.org>:
New bug report received and forwarded. Copy sent to Emacs Bugs <bug-gnu-emacs <at> gnu.org>. (Thu, 25 Dec 2008 18:40:04 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> emacsbugs.donarmstrong.com (full text, mbox):

From: xah lee <xah <at> xahlee.org>
To: bug-gnu-emacs <at> gnu.org
Subject: feature request: correctly display single file zip archive
Date: Thu, 25 Dec 2008 10:30:32 -0800
this might be considered as a feature request or a bug.

Problem:
When opening a zip archive that is just a single file, emacs displays  
gibberish, as opposed to decompressed file content.

(Note: when the zip archive is a directory of files, Emacs behaves  
correctly by showing its file index)

Thanks.

GNU Emacs 22.2.1 (powerpc-apple-darwin8.11.0, Carbon Version 1.6.0)  
of 2008-04-05 on g5.tokyo.stp.isas.jaxa.jp

  Xah
∑ http://xahlee.org/

Information forwarded to bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>:
bug#1702; Package emacs. (Sun, 28 Dec 2008 02:55:04 GMT) Full text and rfc822 format available.

Acknowledgement sent to Chong Yidong <cyd <at> stupidchicken.com>:
Extra info received and forwarded to list. Copy sent to Emacs Bugs <bug-gnu-emacs <at> gnu.org>. (Sun, 28 Dec 2008 02:55:04 GMT) Full text and rfc822 format available.

Message #10 received at 1702 <at> emacsbugs.donarmstrong.com (full text, mbox):

From: Chong Yidong <cyd <at> stupidchicken.com>
To: xah lee <xah <at> xahlee.org>
Cc: 1702 <at> debbugs.gnu.org
Subject: Re: feature request: correctly display single file zip archive
Date: Sat, 27 Dec 2008 21:47:36 -0500
> When opening a zip archive that is just a single file, emacs displays
> gibberish, as opposed to decompressed file content.

I can't reproduce this.  Do you have an example of a zip file that shows
this problem?




Tags added: moreinfo Request was from Glenn Morris <rgm <at> gnu.org> to control <at> emacsbugs.donarmstrong.com. (Sun, 04 Jan 2009 02:15:03 GMT) Full text and rfc822 format available.

Information forwarded to bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>:
bug#1702; Package emacs. (Fri, 16 Jan 2009 20:15:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to xah lee <xah <at> xahlee.org>:
Extra info received and forwarded to list. Copy sent to Emacs Bugs <bug-gnu-emacs <at> gnu.org>. (Fri, 16 Jan 2009 20:15:03 GMT) Full text and rfc822 format available.

Message #17 received at 1702 <at> emacsbugs.donarmstrong.com (full text, mbox):

From: xah lee <xah <at> xahlee.org>
To: Chong Yidong <cyd <at> stupidchicken.com>
Cc: 1702 <at> debbugs.gnu.org
Subject: Re: feature request: correctly display single file zip archive
Date: Fri, 16 Jan 2009 12:09:30 -0800
On Dec 27, 2008, at 6:47 PM, Chong Yidong wrote:

> When opening a zip archive that is just a single file, emacs displays
> gibberish, as opposed to decompressed file content.

I can't reproduce this.  Do you have an example of a zip file that shows
this problem?

---------------------

Sorry, i can't reproduced what i wrote. I think rather that i wrote  
wrong. Here's a correct report:

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.

For what's worth,

Thanks.

  Xah
∑ http://xahlee.org/

Severity set to `wishlist' from `normal' Request was from Chong Yidong <cyd <at> stupidchicken.com> to control <at> emacsbugs.donarmstrong.com. (Fri, 16 Jan 2009 20:30:04 GMT) Full text and rfc822 format available.

Tags removed: moreinfo Request was from Glenn Morris <rgm <at> gnu.org> to control <at> emacsbugs.donarmstrong.com. (Sun, 18 Jan 2009 20:30:03 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#1702; Package emacs. (Thu, 13 Nov 2014 18:40:02 GMT) Full text and rfc822 format available.

Message #24 received at 1702 <at> debbugs.gnu.org (full text, mbox):

From: Matthew Leach <matthew <at> mattleach.net>
To: xah lee <xah <at> xahlee.org>
Cc: 1702 <at> debbugs.gnu.org, Chong Yidong <cyd <at> stupidchicken.com>
Subject: Re: bug#1702: [PATCH]: feature request: correctly display single file
 zip archive
Date: Thu, 13 Nov 2014 18:39:43 +0000
[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


Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#1702; Package emacs. (Thu, 13 Nov 2014 18:51:01 GMT) Full text and rfc822 format available.

Message #27 received at 1702 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Matthew Leach <matthew <at> mattleach.net>
Cc: xah <at> xahlee.org, 1702 <at> debbugs.gnu.org, cyd <at> stupidchicken.com
Subject: Re: bug#1702: [PATCH]: feature request: correctly display single file
 zip	archive
Date: Thu, 13 Nov 2014 20:50:26 +0200
> From: Matthew Leach <matthew <at> mattleach.net>
> Date: Thu, 13 Nov 2014 18:39:43 +0000
> Cc: 1702 <at> debbugs.gnu.org, Chong Yidong <cyd <at> stupidchicken.com>
> 
> 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.

Thanks.

> Any comments welcome!

A comment: if the default is indeed going to be to automatically visit
such a compressed file (and I personally am not convinced it should),
then this is a user-visible change in behavior, so it should be
mentioned in NEWS, and the entry should describe how to get the old
behavior back.

> +(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."

We use a certain style in doc strings of options: the first line
should be a complete sentence.  In addition, option names should begin
with the name of the package.

Also, this is just a boolean yes/no option, so no need to use a symbol
as its value.  Therefor, I suggest:

  (defcustom archive-visit-single-files t
    "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."

(and the corresponding change in the code).




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#1702; Package emacs. (Thu, 13 Nov 2014 19:27:02 GMT) Full text and rfc822 format available.

Message #30 received at 1702 <at> debbugs.gnu.org (full text, mbox):

From: Matthew Leach <matthew <at> mattleach.net>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: xah <at> xahlee.org, 1702 <at> debbugs.gnu.org, cyd <at> stupidchicken.com
Subject: Re: bug#1702: [PATCH]: feature request: correctly display single file
 zip	archive
Date: Thu, 13 Nov 2014 19:26:13 +0000
Hi Eli,

Eli Zaretskii <eliz <at> gnu.org> writes:

[...]

> A comment: if the default is indeed going to be to automatically visit
> such a compressed file (and I personally am not convinced it should),
> then this is a user-visible change in behavior, so it should be
> mentioned in NEWS, and the entry should describe how to get the old
> behavior back.

I think the advantage gained here is transparent editing of compressed
files, like how Emacs can read .el.gz files without having to manually
decompress them first.  Of course, if you think the user-visible change
is too substantial without much benefit, I shall make the current
behaviour default.  Thoughts?
-- 
Matt




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#1702; Package emacs. (Thu, 13 Nov 2014 19:41:02 GMT) Full text and rfc822 format available.

Message #33 received at 1702 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Matthew Leach <matthew <at> mattleach.net>
Cc: xah <at> xahlee.org, 1702 <at> debbugs.gnu.org, cyd <at> stupidchicken.com
Subject: Re: bug#1702: [PATCH]: feature request: correctly display single file
 zip	archive
Date: Thu, 13 Nov 2014 21:39:58 +0200
> From: Matthew Leach <matthew <at> mattleach.net>
> Cc: xah <at> xahlee.org,  1702 <at> debbugs.gnu.org,  cyd <at> stupidchicken.com
> Date: Thu, 13 Nov 2014 19:26:13 +0000
> 
> I think the advantage gained here is transparent editing of compressed
> files, like how Emacs can read .el.gz files without having to manually
> decompress them first.

This won't work without a suitable change to jka-compr.el.

> Of course, if you think the user-visible change is too substantial
> without much benefit, I shall make the current behaviour default.
> Thoughts?

I already expressed my doubts, so let's wait for others to chime in,
if they care.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#1702; Package emacs. (Thu, 13 Nov 2014 19:52:02 GMT) Full text and rfc822 format available.

Message #36 received at 1702 <at> debbugs.gnu.org (full text, mbox):

From: Lars Magne Ingebrigtsen <larsi <at> gnus.org>
To: Matthew Leach <matthew <at> mattleach.net>
Cc: xah <at> xahlee.org, 1702 <at> debbugs.gnu.org, Eli Zaretskii <eliz <at> gnu.org>,
 cyd <at> stupidchicken.com
Subject: Re: bug#1702: [PATCH]: feature request: correctly display single file
 zip	archive
Date: Thu, 13 Nov 2014 20:51:36 +0100
Matthew Leach <matthew <at> mattleach.net> writes:

> I think the advantage gained here is transparent editing of compressed
> files, like how Emacs can read .el.gz files without having to manually
> decompress them first.

If it were possible to edit files inside archives, that would be great.
But that's a pretty major undertaking, I think.

> Of course, if you think the user-visible change is too substantial
> without much benefit, I shall make the current behaviour default.
> Thoughts?

I think it would be nice to go directly to the single file in these
archives, but, on the other hand, it might be kinda surprising.  If
you're visiting an archive, you expect to see the list of files in the
archive.  For one type of archives (ones with a single file in them) to
work differently may be too inconsistent.

So I dunno...  others who want to chime in?

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#1702; Package emacs. (Thu, 13 Nov 2014 19:59:01 GMT) Full text and rfc822 format available.

Message #39 received at 1702 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Lars Magne Ingebrigtsen <larsi <at> gnus.org>
Cc: xah <at> xahlee.org, matthew <at> mattleach.net, cyd <at> stupidchicken.com,
 1702 <at> debbugs.gnu.org
Subject: Re: bug#1702: [PATCH]: feature request: correctly display single file
 zip	archive
Date: Thu, 13 Nov 2014 21:58:17 +0200
> From: Lars Magne Ingebrigtsen <larsi <at> gnus.org>
> Cc: Eli Zaretskii <eliz <at> gnu.org>,  xah <at> xahlee.org,  1702 <at> debbugs.gnu.org,  cyd <at> stupidchicken.com
> Date: Thu, 13 Nov 2014 20:51:36 +0100
> 
> Matthew Leach <matthew <at> mattleach.net> writes:
> 
> > I think the advantage gained here is transparent editing of compressed
> > files, like how Emacs can read .el.gz files without having to manually
> > decompress them first.
> 
> If it were possible to edit files inside archives, that would be great.
> But that's a pretty major undertaking, I think.

Maybe so, but that undertaking was already made many years ago:
arc-mode.el does support editing files in archives.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#1702; Package emacs. (Thu, 13 Nov 2014 20:04:01 GMT) Full text and rfc822 format available.

Message #42 received at 1702 <at> debbugs.gnu.org (full text, mbox):

From: Matthew Leach <matthew <at> mattleach.net>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: xah <at> xahlee.org, 1702 <at> debbugs.gnu.org, cyd <at> stupidchicken.com
Subject: Re: bug#1702: [PATCH]: feature request: correctly display single file
 zip	archive
Date: Thu, 13 Nov 2014 20:03:32 +0000
Eli Zaretskii <eliz <at> gnu.org> writes:

>> From: Matthew Leach <matthew <at> mattleach.net>
>> Cc: xah <at> xahlee.org,  1702 <at> debbugs.gnu.org,  cyd <at> stupidchicken.com
>> Date: Thu, 13 Nov 2014 19:26:13 +0000
>> 
>> I think the advantage gained here is transparent editing of compressed
>> files, like how Emacs can read .el.gz files without having to manually
>> decompress them first.
>
> This won't work without a suitable change to jka-compr.el.

Could you please elaborate on what kind of change would be needed?  From
the small amount of testing I've done so far, it seems to `just work (TM)'.
-- 
Matt




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#1702; Package emacs. (Thu, 13 Nov 2014 20:26:01 GMT) Full text and rfc822 format available.

Message #45 received at 1702 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Matthew Leach <matthew <at> mattleach.net>
Cc: xah <at> xahlee.org, 1702 <at> debbugs.gnu.org, cyd <at> stupidchicken.com
Subject: Re: bug#1702: [PATCH]: feature request: correctly display single file
 zip	archive
Date: Thu, 13 Nov 2014 22:25:13 +0200
> From: Matthew Leach <matthew <at> mattleach.net>
> Cc: xah <at> xahlee.org,  1702 <at> debbugs.gnu.org,  cyd <at> stupidchicken.com
> Date: Thu, 13 Nov 2014 20:03:32 +0000
> 
> Eli Zaretskii <eliz <at> gnu.org> writes:
> 
> >> From: Matthew Leach <matthew <at> mattleach.net>
> >> Cc: xah <at> xahlee.org,  1702 <at> debbugs.gnu.org,  cyd <at> stupidchicken.com
> >> Date: Thu, 13 Nov 2014 19:26:13 +0000
> >> 
> >> I think the advantage gained here is transparent editing of compressed
> >> files, like how Emacs can read .el.gz files without having to manually
> >> decompress them first.
> >
> > This won't work without a suitable change to jka-compr.el.
> 
> Could you please elaborate on what kind of change would be needed?

Do we want to disable decompression when auto-compression-mode is off,
for example?  (I was mistaken: the change to do that needs to be done
in arc-mode.el itself, because it bypasses jka-compr.)




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#1702; Package emacs. (Thu, 13 Nov 2014 20:51:02 GMT) Full text and rfc822 format available.

Message #48 received at 1702 <at> debbugs.gnu.org (full text, mbox):

From: Matthew Leach <matthew <at> mattleach.net>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: xah <at> xahlee.org, 1702 <at> debbugs.gnu.org, cyd <at> stupidchicken.com
Subject: Re: bug#1702: [PATCH]: feature request: correctly display single file
 zip	archive
Date: Thu, 13 Nov 2014 20:50:21 +0000
Eli Zaretskii <eliz <at> gnu.org> writes:

>> From: Matthew Leach <matthew <at> mattleach.net>
>> Cc: xah <at> xahlee.org,  1702 <at> debbugs.gnu.org,  cyd <at> stupidchicken.com
>> Date: Thu, 13 Nov 2014 20:03:32 +0000
>> 
>> Eli Zaretskii <eliz <at> gnu.org> writes:
>> 
>> >> From: Matthew Leach <matthew <at> mattleach.net>
>> >> Cc: xah <at> xahlee.org,  1702 <at> debbugs.gnu.org,  cyd <at> stupidchicken.com
>> >> Date: Thu, 13 Nov 2014 19:26:13 +0000
>> >> 
>> >> I think the advantage gained here is transparent editing of compressed
>> >> files, like how Emacs can read .el.gz files without having to manually
>> >> decompress them first.
>> >
>> > This won't work without a suitable change to jka-compr.el.
>> 
>> Could you please elaborate on what kind of change would be needed?
>
> Do we want to disable decompression when auto-compression-mode is off,
> for example?

I think in the case that the user has auto-compression-mode off, the
archive summary should be shown instead.
-- 
Matt




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#1702; Package emacs. (Fri, 14 Nov 2014 05:28:01 GMT) Full text and rfc822 format available.

Message #51 received at 1702 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Matthew Leach <matthew <at> mattleach.net>
Cc: xah <at> xahlee.org, 1702 <at> debbugs.gnu.org, cyd <at> stupidchicken.com
Subject: Re: bug#1702: [PATCH]: feature request: correctly display single file
 zip	archive
Date: Fri, 14 Nov 2014 07:27:09 +0200
> From: Matthew Leach <matthew <at> mattleach.net>
> Cc: xah <at> xahlee.org,  1702 <at> debbugs.gnu.org,  cyd <at> stupidchicken.com
> Date: Thu, 13 Nov 2014 20:50:21 +0000
> 
> > Do we want to disable decompression when auto-compression-mode is off,
> > for example?
> 
> I think in the case that the user has auto-compression-mode off, the
> archive summary should be shown instead.

I agree.  So this needs to be part of the patch, if the rationale is
what you proposed.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#1702; Package emacs. (Fri, 14 Nov 2014 11:07:02 GMT) Full text and rfc822 format available.

Message #54 received at 1702 <at> debbugs.gnu.org (full text, mbox):

From: Matthew Leach <matthew <at> mattleach.net>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: xah <at> xahlee.org, 1702 <at> debbugs.gnu.org, cyd <at> stupidchicken.com
Subject: Re: bug#1702: [PATCH]: feature request: correctly display single file
 zip	archive
Date: Fri, 14 Nov 2014 11:06:45 +0000
[Message part 1 (text/plain, inline)]
Hi Eli,

Eli Zaretskii <eliz <at> gnu.org> writes:

>> From: Matthew Leach <matthew <at> mattleach.net>
>> Cc: xah <at> xahlee.org,  1702 <at> debbugs.gnu.org,  cyd <at> stupidchicken.com
>> Date: Thu, 13 Nov 2014 20:50:21 +0000
>> 
>> > Do we want to disable decompression when auto-compression-mode is off,
>> > for example?
>> 
>> I think in the case that the user has auto-compression-mode off, the
>> archive summary should be shown instead.
>
> I agree.  So this needs to be part of the patch, if the rationale is
> what you proposed.

Thank you for the review.  The attached patch should take care of
everything mentioned.
-- 
Matt

lisp/ChangeLog:

2014-11-14  Matthew Leach  <matthew <at> mattleach.net>

	* arc-mode.el (archive-visit-single-files): New.
	(archive-mode): Visit file if archive contains a single file.

etc/ChangeLog:

2014-11-14  Matthew Leach  <matthew <at> mattleach.net>

	* NEWS: Mention archive will now visit the file in singular-file
	archives.
[0001-Don-t-show-summary-for-single-file-archives.patch (text/x-diff, inline)]
From fb5402f8fe3e5bdd7e6994cc7fc744d75b0da1da 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 (archive-visit-single-files): New.
(archive-mode): Visit file if archive contains a single file.
* etc/NEWS: Mention archive will now visit the file in singular-file
archives.
---
 etc/NEWS         |  6 ++++++
 lisp/arc-mode.el | 17 ++++++++++++++++-
 2 files changed, 22 insertions(+), 1 deletion(-)

diff --git a/etc/NEWS b/etc/NEWS
index 05210df..2083127 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -184,6 +184,12 @@ appending FUN to `minibuffer-setup-hook'.
 ** cl-lib
 *** New functions cl-fresh-line, cl-digit-char-p and cl-parse-integer.
 
+** Archive
+*** When visiting an archive that contains a single file automatically
+visit that file, rather than displaying the archive summary.  To
+revert to the original behaviour, set `archive-visit-single-files' to
+nil.
+
 ** Calendar and diary
 
 +++
diff --git a/lisp/arc-mode.el b/lisp/arc-mode.el
index ef155ee..80f6564 100644
--- a/lisp/arc-mode.el
+++ b/lisp/arc-mode.el
@@ -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 t
+  "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,13 @@ 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))
+        (let ((archive-buffer (current-buffer)))
+          (rename-buffer (concat " " (buffer-name)))
+          (archive-extract))))))
 
 ;; Archive mode is suitable only for specially formatted data.
 (put 'archive-mode 'mode-class 'special)
-- 
2.1.3


Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#1702; Package emacs. (Fri, 14 Nov 2014 11:32:02 GMT) Full text and rfc822 format available.

Message #57 received at 1702 <at> debbugs.gnu.org (full text, mbox):

From: Matthew Leach <matthew <at> mattleach.net>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: xah <at> xahlee.org, 1702 <at> debbugs.gnu.org, cyd <at> stupidchicken.com
Subject: Re: bug#1702: [PATCH]: feature request: correctly display single file
 zip	archive
Date: Fri, 14 Nov 2014 11:31:29 +0000
[Message part 1 (text/plain, inline)]
Matthew Leach <matthew <at> mattleach.net> writes:

[...]

> @@ -742,7 +751,13 @@ 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))
> +        (let ((archive-buffer (current-buffer)))

Oops, the `let' isn't needed anymore.

Sorry for the noise.
-- 
Matt

[0001-Don-t-show-summary-for-single-file-archives.patch (text/x-diff, inline)]
From a6ec5479a42c130c36d7d628fa976630b19d741c 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 (archive-visit-single-files): New.
(archive-mode): Visit file if archive contains a single file.
* etc/NEWS: Mention archive will now visit the file in singular-file
archives.
---
 etc/NEWS         |  6 ++++++
 lisp/arc-mode.el | 16 +++++++++++++++-
 2 files changed, 21 insertions(+), 1 deletion(-)

diff --git a/etc/NEWS b/etc/NEWS
index 05210df..2083127 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -184,6 +184,12 @@ appending FUN to `minibuffer-setup-hook'.
 ** cl-lib
 *** New functions cl-fresh-line, cl-digit-char-p and cl-parse-integer.
 
+** Archive
+*** When visiting an archive that contains a single file automatically
+visit that file, rather than displaying the archive summary.  To
+revert to the original behaviour, set `archive-visit-single-files' to
+nil.
+
 ** Calendar and diary
 
 +++
diff --git a/lisp/arc-mode.el b/lisp/arc-mode.el
index ef155ee..3026a6a 100644
--- a/lisp/arc-mode.el
+++ b/lisp/arc-mode.el
@@ -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 t
+  "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)
-- 
2.1.3


Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#1702; Package emacs. (Tue, 18 Nov 2014 13:06:01 GMT) Full text and rfc822 format available.

Message #60 received at 1702 <at> debbugs.gnu.org (full text, mbox):

From: Daniel Colascione <dancol <at> dancol.org>
To: Matthew Leach <matthew <at> mattleach.net>, Eli Zaretskii <eliz <at> gnu.org>
Cc: xah <at> xahlee.org, 1702 <at> debbugs.gnu.org, cyd <at> stupidchicken.com
Subject: Re: bug#1702: [PATCH]: feature request: correctly display single
 file zip	archive
Date: Tue, 18 Nov 2014 05:04:54 -0800
[Message part 1 (text/plain, inline)]
On 11/14/2014 03:31 AM, Matthew Leach wrote:
> Matthew Leach <matthew <at> mattleach.net> writes:
> 

I don't think the new behavior should be the default. I'd prefer to avoid making a special case for singleton zip files and let users opt into the special case when it's convenient for their workflow. Special cases make programs hard to learn.

[signature.asc (application/pgp-signature, attachment)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#1702; Package emacs. (Tue, 18 Nov 2014 13:24:02 GMT) Full text and rfc822 format available.

Message #63 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Rasmus <rasmus <at> gmx.us>
To: bug-gnu-emacs <at> gnu.org
Subject: Re: bug#1702: [PATCH]: feature request: correctly display single file
 zip	archive
Date: Tue, 18 Nov 2014 14:22:36 +0100
Lars Magne Ingebrigtsen <larsi <at> gnus.org> writes:

> I think it would be nice to go directly to the single file in these
> archives, but, on the other hand, it might be kinda surprising.  If
> you're visiting an archive, you expect to see the list of files in the
> archive.  For one type of archives (ones with a single file in them) to
> work differently may be too inconsistent.
>
> So I dunno...  others who want to chime in?

If I get the zip from somewhere I probably don't know it's a single-file
zip beforehand. . .  So maybe displaying it in tar-mode (or whatever
it's called) and requiring one more RET is better.

How about a zip file that contains only one folder and one file, like
    folder/
    folder/txt

I don't necessarily agree that the proposed behavior is the logically
correct thing to do in the case of an archive that is not "obviously"(?)
a file (like foo.el.gz).

—Rasmus

-- 
However beautiful the theory, you should occasionally look at the evidence





Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#1702; Package emacs. (Tue, 18 Nov 2014 20:13:02 GMT) Full text and rfc822 format available.

Message #66 received at 1702 <at> debbugs.gnu.org (full text, mbox):

From: Matthew Leach <matthew <at> mattleach.net>
To: Daniel Colascione <dancol <at> dancol.org>
Cc: xah <at> xahlee.org, 1702 <at> debbugs.gnu.org, Eli Zaretskii <eliz <at> gnu.org>,
 cyd <at> stupidchicken.com
Subject: Re: bug#1702: [PATCH]: feature request: correctly display single file
 zip	archive
Date: Tue, 18 Nov 2014 20:12:25 +0000
[Message part 1 (text/plain, inline)]
Daniel Colascione <dancol <at> dancol.org> writes:

> On 11/14/2014 03:31 AM, Matthew Leach wrote:
>> Matthew Leach <matthew <at> mattleach.net> writes:
>> 
>
> I don't think the new behavior should be the default. 

It seems as though that is the consensus.  Revised patch included that
turns off the feature by default.

Thanks,
Matt

lisp/ChangeLog:
2014-11-13  Matthew Leach  <matthew <at> mattleach.net>

        * arc-mode.el (archive-visit-single-files): New.
        (archive-mode): Visit file if archive contains a single file.

[arc-single-file-mode.patch (text/x-diff, inline)]
diff --git a/lisp/arc-mode.el b/lisp/arc-mode.el
index ef155ee..9833c90 100644
--- a/lisp/arc-mode.el
+++ b/lisp/arc-mode.el
@@ -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)

Reply sent to Eli Zaretskii <eliz <at> gnu.org>:
You have taken responsibility. (Fri, 21 Nov 2014 10:11:02 GMT) Full text and rfc822 format available.

Notification sent to xah lee <xah <at> xahlee.org>:
bug acknowledged by developer. (Fri, 21 Nov 2014 10:11:02 GMT) Full text and rfc822 format available.

Message #71 received at 1702-done <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Matthew Leach <matthew <at> mattleach.net>
Cc: xah <at> xahlee.org, 1702-done <at> debbugs.gnu.org, cyd <at> stupidchicken.com,
 dancol <at> dancol.org
Subject: Re: bug#1702: [PATCH]: feature request: correctly display single file
 zip	archive
Date: Fri, 21 Nov 2014 12:10:00 +0200
> From: Matthew Leach <matthew <at> mattleach.net>
> Cc: Eli Zaretskii <eliz <at> gnu.org>,  xah <at> xahlee.org,  1702 <at> debbugs.gnu.org,  cyd <at> stupidchicken.com
> Date: Tue, 18 Nov 2014 20:12:25 +0000
> 
> Daniel Colascione <dancol <at> dancol.org> writes:
> 
> > On 11/14/2014 03:31 AM, Matthew Leach wrote:
> >> Matthew Leach <matthew <at> mattleach.net> writes:
> >> 
> >
> > I don't think the new behavior should be the default. 
> 
> It seems as though that is the consensus.  Revised patch included that
> turns off the feature by default.

Thanks, I pushed this in your name, and I'm closing the bug.




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Fri, 19 Dec 2014 12:24:03 GMT) Full text and rfc822 format available.

This bug report was last modified 10 years and 263 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.