bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#47119: 28.0.50; [patch][Dired] new user option for compressing dir s


From: Eli Zaretskii
Subject: bug#47119: 28.0.50; [patch][Dired] new user option for compressing dir suffix
Date: Sat, 20 Mar 2021 12:37:13 +0200

> Date: Thu, 18 Mar 2021 23:41:53 +0800
> From: Lin Sun <lin.sun@zoom.us>
> Cc: "47119@debbugs.gnu.org" <47119@debbugs.gnu.org>, 
>       sunlin <sunlin7@yahoo.com>
> 
> > 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.





reply via email to

[Prev in Thread] Current Thread [Next in Thread]