From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#47119: 28.0.50; [patch][Dired] new user option for compressing dir suffix Date: Sat, 20 Mar 2021 12:37:13 +0200 Message-ID: <83lfaicdra.fsf@gnu.org> References: <605374ce.1c69fb81.54cb0.69c6@mx.google.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="17587"; mail-complaints-to="usenet@ciao.gmane.io" Cc: sunlin7@yahoo.com, 47119@debbugs.gnu.org To: Lin Sun Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sat Mar 20 11:38:27 2021 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lNYzy-0004TY-VG for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 20 Mar 2021 11:38:26 +0100 Original-Received: from localhost ([::1]:47468 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lNYzx-0002Yc-MV for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 20 Mar 2021 06:38:25 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:34546) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lNYza-0002YV-On for bug-gnu-emacs@gnu.org; Sat, 20 Mar 2021 06:38:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:40027) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lNYza-0000pQ-Ge for bug-gnu-emacs@gnu.org; Sat, 20 Mar 2021 06:38:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1lNYza-0006IA-EK for bug-gnu-emacs@gnu.org; Sat, 20 Mar 2021 06:38:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 20 Mar 2021 10:38:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 47119 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 47119-submit@debbugs.gnu.org id=B47119.161623664524137 (code B ref 47119); Sat, 20 Mar 2021 10:38:02 +0000 Original-Received: (at 47119) by debbugs.gnu.org; 20 Mar 2021 10:37:25 +0000 Original-Received: from localhost ([127.0.0.1]:51573 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lNYyz-0006HF-9b for submit@debbugs.gnu.org; Sat, 20 Mar 2021 06:37:25 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:41514) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lNYyw-0006H1-Ss for 47119@debbugs.gnu.org; Sat, 20 Mar 2021 06:37:24 -0400 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]:52245) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lNYyr-0000O5-7j; Sat, 20 Mar 2021 06:37:17 -0400 Original-Received: from 84.94.185.95.cable.012.net.il ([84.94.185.95]:3121 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1lNYyq-0000uj-HB; Sat, 20 Mar 2021 06:37:17 -0400 In-Reply-To: <605374ce.1c69fb81.54cb0.69c6@mx.google.com> (message from Lin Sun on Thu, 18 Mar 2021 23:41:53 +0800) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list 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-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:202735 Archived-At: > Date: Thu, 18 Mar 2021 23:41:53 +0800 > From: Lin Sun > Cc: "47119@debbugs.gnu.org" <47119@debbugs.gnu.org>, > sunlin > > > but wouldn't it be better to use symbols instead of strings? > > The new option `dired-compress-files-default-suffix` can be “.tar.gz” or “.tar.xz”… and it should work with > variable ` dired-compress-file-suffixes` while this variable maybe extended by user. So the type:string is > simple for implementation. Getting a string (the name of a symbol) from a symbol is very easy, so I'm not sure I understand the reasoning. But I won't insist. > ++++ > +*** New user option 'dired-compress-files-default-suffix'. > +This user option controls default suffix for compressing directory. If it's > +nil, the ".tar.gz" will be used. Refer the 'dired-compress-files-alist' for > +supported suffix list. ^^^^^^^^^ "Refer to the ..." > - ;; This item controls the compression of directories. Its REGEXP > - ;; element should never match any valid file name. > - ("\000" ".tar.gz" "tar -cf - %i | gzip -c9 > %o")) > + ("\\.tar\\'" ".tgz" nil)) Why did you remove the "\000" entry? As the comment explains, it is there to allow compressing a directory. To compress a directory, you need to run 'tar' on it first, and the .tar.gz/.tar.xz entries run 'tar' on the _result_ of gzip/xz instead. So how will compression of directories work after your changes? I feel that I'm missing something here, but what? > +(defcustom dired-compress-files-default-suffix nil > + "Default suffix for compressing directory. ^^^^^^^^^ "directories", in plural. > +If nil, the \".tar.gz\" will be used. See `dired-compress-files-alist' for \ > +the supported suffixes list." ^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^ "for the list of supported suffixes" > + (rule (cl-find-if > + (lambda (x) (string-match-p (car x) suffix)) > + dired-compress-files-alist))) Do we really need cl-find-if here? what's wrong with assoc? Thanks.