From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Matthew Leach Newsgroups: gmane.emacs.bugs Subject: bug#1702: [PATCH]: feature request: correctly display single file zip archive Date: Fri, 14 Nov 2014 11:06:45 +0000 Message-ID: <87sihmjb22.fsf@mattleach.net> References: <87lju1hv7b.fsf@cyd.mit.edu> <13EFAAB6-C6B3-4F67-A39A-5266E91A0CD5@xahlee.org> <87wq6zj66o.fsf_-_@loki.home> <83ppcrj5ot.fsf@gnu.org> <87r3x6kilm.fsf@loki.home> <83lhnekhyp.fsf@gnu.org> <87mw7ukgvf.fsf@loki.home> <83h9y2kfva.fsf@gnu.org> <87a93ukepe.fsf@loki.home> <83d28qjqs2.fsf@gnu.org> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Trace: ger.gmane.org 1415963624 11017 80.91.229.3 (14 Nov 2014 11:13:44 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 14 Nov 2014 11:13:44 +0000 (UTC) Cc: xah@xahlee.org, 1702@debbugs.gnu.org, cyd@stupidchicken.com To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Fri Nov 14 12:13:36 2014 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1XpEop-0002Fq-5K for geb-bug-gnu-emacs@m.gmane.org; Fri, 14 Nov 2014 12:13:35 +0100 Original-Received: from localhost ([::1]:35917 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XpEoo-0003xn-NG for geb-bug-gnu-emacs@m.gmane.org; Fri, 14 Nov 2014 06:13:34 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:53430) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XpEia-00026n-GB for bug-gnu-emacs@gnu.org; Fri, 14 Nov 2014 06:07:13 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XpEiU-0001t4-HD for bug-gnu-emacs@gnu.org; Fri, 14 Nov 2014 06:07:08 -0500 Original-Received: from debbugs.gnu.org ([140.186.70.43]:34777) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XpEiU-0001t0-AW for bug-gnu-emacs@gnu.org; Fri, 14 Nov 2014 06:07:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.80) (envelope-from ) id 1XpEiU-000682-3j for bug-gnu-emacs@gnu.org; Fri, 14 Nov 2014 06:07:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Matthew Leach Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 14 Nov 2014 11:07:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 1702 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 1702-submit@debbugs.gnu.org id=B1702.141596321623545 (code B ref 1702); Fri, 14 Nov 2014 11:07:02 +0000 Original-Received: (at 1702) by debbugs.gnu.org; 14 Nov 2014 11:06:56 +0000 Original-Received: from localhost ([127.0.0.1]:60223 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1XpEiO-00067h-4c for submit@debbugs.gnu.org; Fri, 14 Nov 2014 06:06:56 -0500 Original-Received: from mx0.mattleach.net ([176.58.118.143]:56738) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1XpEiM-00067Z-HM for 1702@debbugs.gnu.org; Fri, 14 Nov 2014 06:06:55 -0500 Original-Received: by mx0.mattleach.net (Postfix, from userid 99) id AB46C61AC8; Fri, 14 Nov 2014 11:06:53 +0000 (GMT) Original-Received: from loki.mattleach.net (host86-180-142-129.range86-180.btcentralplus.com [86.180.142.129]) by mx0.mattleach.net (Postfix) with ESMTPSA id 97A2961ABC; Fri, 14 Nov 2014 11:06:46 +0000 (GMT) In-Reply-To: <83d28qjqs2.fsf@gnu.org> (Eli Zaretskii's message of "Fri, 14 Nov 2014 07:27:09 +0200") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.0.50 (gnu/linux) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 140.186.70.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:95985 --=-=-= Content-Type: text/plain Hi Eli, Eli Zaretskii writes: >> From: Matthew Leach >> Cc: xah@xahlee.org, 1702@debbugs.gnu.org, cyd@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 * 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 * NEWS: Mention archive will now visit the file in singular-file archives. --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=0001-Don-t-show-summary-for-single-file-archives.patch >From fb5402f8fe3e5bdd7e6994cc7fc744d75b0da1da Mon Sep 17 00:00:00 2001 From: Matthew Leach 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 --=-=-=--