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:31:29 +0000 Message-ID: <87lhnej9wu.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> <87sihmjb22.fsf@mattleach.net> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Trace: ger.gmane.org 1415964747 29791 80.91.229.3 (14 Nov 2014 11:32:27 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 14 Nov 2014 11:32:27 +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:32:19 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 1XpF6x-0003A7-BM for geb-bug-gnu-emacs@m.gmane.org; Fri, 14 Nov 2014 12:32:19 +0100 Original-Received: from localhost ([::1]:35960 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XpF6w-0001V9-JB for geb-bug-gnu-emacs@m.gmane.org; Fri, 14 Nov 2014 06:32:18 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:58666) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XpF6n-0001SE-8s for bug-gnu-emacs@gnu.org; Fri, 14 Nov 2014 06:32:15 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XpF6h-0000EN-0e for bug-gnu-emacs@gnu.org; Fri, 14 Nov 2014 06:32:09 -0500 Original-Received: from debbugs.gnu.org ([140.186.70.43]:34785) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XpF6g-0000EJ-Lg for bug-gnu-emacs@gnu.org; Fri, 14 Nov 2014 06:32:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.80) (envelope-from ) id 1XpF6g-0006mO-Cy for bug-gnu-emacs@gnu.org; Fri, 14 Nov 2014 06:32: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:32: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.141596469626019 (code B ref 1702); Fri, 14 Nov 2014 11:32:02 +0000 Original-Received: (at 1702) by debbugs.gnu.org; 14 Nov 2014 11:31:36 +0000 Original-Received: from localhost ([127.0.0.1]:60231 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1XpF6F-0006la-SY for submit@debbugs.gnu.org; Fri, 14 Nov 2014 06:31:36 -0500 Original-Received: from mx0.mattleach.net ([176.58.118.143]:56760) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1XpF6D-0006lQ-6d for 1702@debbugs.gnu.org; Fri, 14 Nov 2014 06:31:34 -0500 Original-Received: by mx0.mattleach.net (Postfix, from userid 99) id C3C0261AC8; Fri, 14 Nov 2014 11:31:32 +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 E4C8361ABC; Fri, 14 Nov 2014 11:31:30 +0000 (GMT) In-Reply-To: <87sihmjb22.fsf@mattleach.net> (Matthew Leach's message of "Fri, 14 Nov 2014 11:06:45 +0000") 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:95987 --=-=-= Content-Type: text/plain Matthew Leach 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 --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=0001-Don-t-show-summary-for-single-file-archives.patch >From a6ec5479a42c130c36d7d628fa976630b19d741c 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 | 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 --=-=-=--