From: Matthew Leach <matthew@mattleach.net>
To: xah lee <xah@xahlee.org>
Cc: 1702@debbugs.gnu.org, Chong Yidong <cyd@stupidchicken.com>
Subject: bug#1702: [PATCH]: feature request: correctly display single file zip archive
Date: Thu, 13 Nov 2014 18:39:43 +0000 [thread overview]
Message-ID: <87wq6zj66o.fsf_-_@loki.home> (raw)
In-Reply-To: <13EFAAB6-C6B3-4F67-A39A-5266E91A0CD5@xahlee.org> (xah lee's message of "Fri, 16 Jan 2009 12:09:30 -0800")
[-- Attachment #1: Type: text/plain, Size: 611 bytes --]
Hi all,
xah lee <xah@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@mattleach.net>
* arc-mode.el (singular-file-archive-action): New.
(archive-mode): Visit file if archive contains a single file.
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-Don-t-show-summary-for-single-file-archives.patch --]
[-- Type: text/x-diff, Size: 1687 bytes --]
From 1c84ec04f024f9de44b0bb57d60d009b9738c899 Mon Sep 17 00:00:00 2001
From: Matthew Leach <matthew@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
next prev parent reply other threads:[~2014-11-13 18:39 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-12-28 2:47 bug#1702: feature request: correctly display single file zip archive Chong Yidong
2009-01-16 20:09 ` xah lee
2014-11-13 18:39 ` Matthew Leach [this message]
2014-11-13 18:50 ` bug#1702: [PATCH]: " Eli Zaretskii
2014-11-13 19:26 ` Matthew Leach
2014-11-13 19:39 ` Eli Zaretskii
2014-11-13 20:03 ` Matthew Leach
2014-11-13 20:25 ` Eli Zaretskii
2014-11-13 20:50 ` Matthew Leach
2014-11-14 5:27 ` Eli Zaretskii
2014-11-14 11:06 ` Matthew Leach
2014-11-14 11:31 ` Matthew Leach
2014-11-18 13:04 ` Daniel Colascione
2014-11-18 20:12 ` Matthew Leach
2014-11-21 10:10 ` Eli Zaretskii
2014-11-13 19:51 ` Lars Magne Ingebrigtsen
2008-12-25 18:30 ` bug#1702: " xah lee
2014-11-18 13:22 ` bug#1702: [PATCH]: " Rasmus
2014-11-13 19:58 ` Eli Zaretskii
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87wq6zj66o.fsf_-_@loki.home \
--to=matthew@mattleach.net \
--cc=1702@debbugs.gnu.org \
--cc=cyd@stupidchicken.com \
--cc=xah@xahlee.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).