unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#47119: 28.0.50; [patch][Dired] new user option for compressing dir suffix
@ 2021-03-13  3:55 Lin Sun via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2021-03-13  7:37 ` Eli Zaretskii
                   ` (2 more replies)
  0 siblings, 3 replies; 18+ messages in thread
From: Lin Sun via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2021-03-13  3:55 UTC (permalink / raw)
  To: 47119

[-- Attachment #1: Type: text/plain, Size: 123 bytes --]

Hi,

A new user option `dired-compress-files-default-suffix' for
controlling the default format for compressing directory.

[-- Attachment #2: 0001-dired-new-user-option-dired-compress-files-default-suffix.patch --]
[-- Type: application/octet-stream, Size: 5808 bytes --]

From 873f76039510a1aef24567d9d6c8a1ecb0816a92 Mon Sep 17 00:00:00 2001
From: Lin Sun <lin.sun@zoom.us>
Date: Sat, 13 Mar 2021 11:47:23 +0800
Subject: [PATCH] [*dired] new user option
 'dired-compress-files-default-suffix'

*dired-aux.el: user option 'dired-compress-files-default-suffix' for
default suffix for compressing directory.
---
 doc/emacs/dired.texi |  4 +++-
 etc/NEWS             |  6 ++++++
 lisp/dired-aux.el    | 48 ++++++++++++++++++++++++++++++------------------
 3 files changed, 39 insertions(+), 19 deletions(-)

diff --git a/doc/emacs/dired.texi b/doc/emacs/dired.texi
index f57606d..16a9ef8 100644
--- a/doc/emacs/dired.texi
+++ b/doc/emacs/dired.texi
@@ -868,7 +868,9 @@ Operating on Files
 @command{gzip}.  To allow decompression of compressed directories,
 typing @kbd{Z} on a @file{.tar.gz} or @file{.tgz} archive file unpacks
 all the files in the archive into a directory whose name is the
-archive name with the extension removed.
+archive name with the extension removed.  By setting the variable
+@code{dired-compress-files-default-suffix} can switch to other format,
+refer the @code{dired-compress-files-alist} for complete suffix list.
 
 @findex dired-do-compress-to
 @kindex c @r{(Dired)}
diff --git a/etc/NEWS b/etc/NEWS
index fa8784d..e20beee 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -635,6 +635,12 @@ line, and allows truncating them (to preserve space on the mode line)
 or showing them literally, either instead of, or in addition to,
 displaying "by name" or "by date" sort order.
 
++++
+*** 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.
+
 ---
 *** Broken and circular links are shown with the 'dired-broken-symlink' face.
 
diff --git a/lisp/dired-aux.el b/lisp/dired-aux.el
index d5f4910..b2a5034 100644
--- a/lisp/dired-aux.el
+++ b/lisp/dired-aux.el
@@ -1132,6 +1132,7 @@ dired-compress-file-suffixes
     ;; Solaris 10 version of tar (obsolete in 2024?).
     ;; Same thing on AIX 7.1 (obsolete 2023?) and 7.2 (obsolete 2022?).
     ("\\.tar\\.gz\\'" "" "gzip -dc %i | tar -xf -")
+    ("\\.tar\\.xz\\'" "" "xz -dc %i | tar -xf -")
     ("\\.tgz\\'" "" "gzip -dc %i | tar -xf -")
     ("\\.gz\\'" "" "gunzip")
     ("\\.lz\\'" "" "lzip -d")
@@ -1149,10 +1150,7 @@ dired-compress-file-suffixes
     ("\\.zst\\'" "" "unzstd --rm")
     ("\\.7z\\'" "" "7z x -aoa -o%o %i")
     ;; This item controls naming for compression.
-    ("\\.tar\\'" ".tgz" nil)
-    ;; 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))
   "Control changes in file name suffixes for compression and uncompression.
 Each element specifies one transformation rule, and has the form:
   (REGEXP NEW-SUFFIX PROGRAM)
@@ -1168,6 +1166,12 @@ dired-compress-file-suffixes
 Otherwise, the rule is a compression rule, and compression is done with gzip.
 ARGS are command switches passed to PROGRAM.")
 
+(defcustom dired-compress-files-default-suffix nil
+  "Default suffix for compressing directory.
+If nil, the \".tar.gz\" will be used."
+  :group 'dired
+  :version "28.1")
+
 (defvar dired-compress-files-alist
   '(("\\.tar\\.gz\\'" . "tar -cf - %i | gzip -c9 > %o")
     ("\\.tar\\.bz2\\'" . "tar -cf - %i | bzip2 -c9 > %o")
@@ -1275,20 +1279,28 @@ dired-compress-file
            ;; Try gzip; if we don't have that, use compress.
            (condition-case nil
                (if (file-directory-p file)
-                   (progn
-                     (setq suffix (cdr (assoc "\000" dired-compress-file-suffixes)))
-                     (when suffix
-                       (let ((out-name (concat file (car suffix)))
-                             (default-directory (file-name-directory file)))
-                         (dired-shell-command
-                          (replace-regexp-in-string
-                           "%o" (shell-quote-argument out-name)
-                           (replace-regexp-in-string
-                            "%i" (shell-quote-argument (file-name-nondirectory file))
-                            (cadr suffix)
-                            nil t)
-                           nil t))
-                         out-name)))
+                   (let* ((suffix
+                           (or dired-compress-files-default-suffix ".tar.gz"))
+                          (rule (cl-find-if
+                                 (lambda (x) (string-match-p (car x) suffix))
+                                 dired-compress-files-alist)))
+                     (if rule
+                         (let ((out-name (concat file suffix))
+                               (default-directory (file-name-directory file)))
+                           (dired-shell-command
+                            (replace-regexp-in-string
+                             "%o" (shell-quote-argument out-name)
+                             (replace-regexp-in-string
+                              "%i" (shell-quote-argument (file-name-nondirectory file))
+                              (cdr rule)
+                              nil t)
+                             nil t))
+                           out-name)
+                       (user-error
+                        "No compression rule found for \
+`dired-compress-files-default-suffix' %s, see `dired-compress-files-alist' for\
+ the supported suffixes list."
+                        dired-compress-files-default-suffix)))
                  (let ((out-name (concat file ".gz")))
                    (and (or (not (file-exists-p out-name))
                             (y-or-n-p
-- 
2.7.0


^ permalink raw reply related	[flat|nested] 18+ messages in thread

* bug#47119: 28.0.50; [patch][Dired] new user option for compressing dir suffix
  2021-03-13  3:55 bug#47119: 28.0.50; [patch][Dired] new user option for compressing dir suffix Lin Sun via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2021-03-13  7:37 ` Eli Zaretskii
  2021-03-13  7:50   ` Lin Sun via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2021-03-18 15:41 ` bug#47119: " Lin Sun via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2021-03-18 15:41 ` bug#47119: " Lin Sun via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2 siblings, 1 reply; 18+ messages in thread
From: Eli Zaretskii @ 2021-03-13  7:37 UTC (permalink / raw)
  To: Lin Sun; +Cc: 47119

> Date: Sat, 13 Mar 2021 11:55:48 +0800
> From:  Lin Sun via "Bug reports for GNU Emacs,
>  the Swiss army knife of text editors" <bug-gnu-emacs@gnu.org>
> 
> A new user option `dired-compress-files-default-suffix' for
> controlling the default format for compressing directory.

Thanks, but wouldn't it be better to use symbols instead of strings?
That way, we could prevent typos easier, and also offer completion for
setting the option interactively.

Also, doesn't the user manual need to be changed as well?





^ permalink raw reply	[flat|nested] 18+ messages in thread

* bug#47119: 28.0.50; [patch][Dired] new user option for compressing dir suffix
  2021-03-13  7:37 ` Eli Zaretskii
@ 2021-03-13  7:50   ` Lin Sun via Bug reports for GNU Emacs, the Swiss army knife of text editors
  0 siblings, 0 replies; 18+ messages in thread
From: Lin Sun via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2021-03-13  7:50 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: sunlin, 47119

[-- Attachment #1: Type: text/plain, Size: 749 bytes --]

Hi Eli,

Thanks for your comments, I add the ":type 'string" for this new
option, and the manual change is reverted now. New patch is attached.

On Sat, Mar 13, 2021 at 3:37 PM Eli Zaretskii <eliz@gnu.org> wrote:
>
> > Date: Sat, 13 Mar 2021 11:55:48 +0800
> > From:  Lin Sun via "Bug reports for GNU Emacs,
> >  the Swiss army knife of text editors" <bug-gnu-emacs@gnu.org>
> >
> > A new user option `dired-compress-files-default-suffix' for
> > controlling the default format for compressing directory.
>
> Thanks, but wouldn't it be better to use symbols instead of strings?
> That way, we could prevent typos easier, and also offer completion for
> setting the option interactively.
>
> Also, doesn't the user manual need to be changed as well?

[-- Attachment #2: 0001-dired-new-user-option-dired-compress-files-default-suffix.patch --]
[-- Type: application/octet-stream, Size: 5096 bytes --]

From 1a55db2623e9cdb3d55c538a2518178cc6b280f9 Mon Sep 17 00:00:00 2001
From: Lin Sun <lin.sun@zoom.us>
Date: Sat, 13 Mar 2021 11:47:23 +0800
Subject: [PATCH] [*dired] new user option
 'dired-compress-files-default-suffix'

*dired-aux.el: user option 'dired-compress-files-default-suffix' for
default suffix for compressing directory.
---
 etc/NEWS          |  6 ++++++
 lisp/dired-aux.el | 49 +++++++++++++++++++++++++++++++------------------
 2 files changed, 37 insertions(+), 18 deletions(-)

diff --git a/etc/NEWS b/etc/NEWS
index fa8784d..e20beee 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -635,6 +635,12 @@ line, and allows truncating them (to preserve space on the mode line)
 or showing them literally, either instead of, or in addition to,
 displaying "by name" or "by date" sort order.
 
++++
+*** 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.
+
 ---
 *** Broken and circular links are shown with the 'dired-broken-symlink' face.
 
diff --git a/lisp/dired-aux.el b/lisp/dired-aux.el
index d5f4910..237182e 100644
--- a/lisp/dired-aux.el
+++ b/lisp/dired-aux.el
@@ -1132,6 +1132,7 @@ dired-compress-file-suffixes
     ;; Solaris 10 version of tar (obsolete in 2024?).
     ;; Same thing on AIX 7.1 (obsolete 2023?) and 7.2 (obsolete 2022?).
     ("\\.tar\\.gz\\'" "" "gzip -dc %i | tar -xf -")
+    ("\\.tar\\.xz\\'" "" "xz -dc %i | tar -xf -")
     ("\\.tgz\\'" "" "gzip -dc %i | tar -xf -")
     ("\\.gz\\'" "" "gunzip")
     ("\\.lz\\'" "" "lzip -d")
@@ -1149,10 +1150,7 @@ dired-compress-file-suffixes
     ("\\.zst\\'" "" "unzstd --rm")
     ("\\.7z\\'" "" "7z x -aoa -o%o %i")
     ;; This item controls naming for compression.
-    ("\\.tar\\'" ".tgz" nil)
-    ;; 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))
   "Control changes in file name suffixes for compression and uncompression.
 Each element specifies one transformation rule, and has the form:
   (REGEXP NEW-SUFFIX PROGRAM)
@@ -1168,6 +1166,13 @@ dired-compress-file-suffixes
 Otherwise, the rule is a compression rule, and compression is done with gzip.
 ARGS are command switches passed to PROGRAM.")
 
+(defcustom dired-compress-files-default-suffix nil
+  "Default suffix for compressing directory.
+If nil, the \".tar.gz\" will be used."
+  :type 'string
+  :group 'dired
+  :version "28.1")
+
 (defvar dired-compress-files-alist
   '(("\\.tar\\.gz\\'" . "tar -cf - %i | gzip -c9 > %o")
     ("\\.tar\\.bz2\\'" . "tar -cf - %i | bzip2 -c9 > %o")
@@ -1275,20 +1280,28 @@ dired-compress-file
            ;; Try gzip; if we don't have that, use compress.
            (condition-case nil
                (if (file-directory-p file)
-                   (progn
-                     (setq suffix (cdr (assoc "\000" dired-compress-file-suffixes)))
-                     (when suffix
-                       (let ((out-name (concat file (car suffix)))
-                             (default-directory (file-name-directory file)))
-                         (dired-shell-command
-                          (replace-regexp-in-string
-                           "%o" (shell-quote-argument out-name)
-                           (replace-regexp-in-string
-                            "%i" (shell-quote-argument (file-name-nondirectory file))
-                            (cadr suffix)
-                            nil t)
-                           nil t))
-                         out-name)))
+                   (let* ((suffix
+                           (or dired-compress-files-default-suffix ".tar.gz"))
+                          (rule (cl-find-if
+                                 (lambda (x) (string-match-p (car x) suffix))
+                                 dired-compress-files-alist)))
+                     (if rule
+                         (let ((out-name (concat file suffix))
+                               (default-directory (file-name-directory file)))
+                           (dired-shell-command
+                            (replace-regexp-in-string
+                             "%o" (shell-quote-argument out-name)
+                             (replace-regexp-in-string
+                              "%i" (shell-quote-argument (file-name-nondirectory file))
+                              (cdr rule)
+                              nil t)
+                             nil t))
+                           out-name)
+                       (user-error
+                        "No compression rule found for \
+`dired-compress-files-default-suffix' %s, see `dired-compress-files-alist' for\
+ the supported suffixes list."
+                        dired-compress-files-default-suffix)))
                  (let ((out-name (concat file ".gz")))
                    (and (or (not (file-exists-p out-name))
                             (y-or-n-p
-- 
2.7.0


^ permalink raw reply related	[flat|nested] 18+ messages in thread

* bug#47119: Re: bug#47119: 28.0.50; [patch][Dired] new user option for compressing dir suffix
  2021-03-13  3:55 bug#47119: 28.0.50; [patch][Dired] new user option for compressing dir suffix Lin Sun via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2021-03-13  7:37 ` Eli Zaretskii
  2021-03-18 15:41 ` bug#47119: " Lin Sun via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2021-03-18 15:41 ` Lin Sun via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2021-03-20 10:37   ` Eli Zaretskii
  2 siblings, 1 reply; 18+ messages in thread
From: Lin Sun via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2021-03-18 15:41 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: sunlin, 47119@debbugs.gnu.org

[-- Attachment #1: Type: text/html, Size: 1875 bytes --]

[-- Attachment #2: 0001-dired-new-user-option-dired-compress-files-default-s.patch --]
[-- Type: application/octet-stream, Size: 6347 bytes --]

From e7d8f160784d16d641d7e719b941a427b11126d9 Mon Sep 17 00:00:00 2001
From: Lin Sun <lin.sun@zoom.us>
Date: Sat, 13 Mar 2021 11:47:23 +0800
Subject: [PATCH] [*dired] new user option
 'dired-compress-files-default-suffix'

*dired-aux.el: user option 'dired-compress-files-default-suffix' for
default suffix for compressing directory.
---
 doc/emacs/dired.texi | 12 ++++++++----
 etc/NEWS             |  6 ++++++
 lisp/dired-aux.el    | 50 ++++++++++++++++++++++++++++++++------------------
 3 files changed, 46 insertions(+), 22 deletions(-)

diff --git a/doc/emacs/dired.texi b/doc/emacs/dired.texi
index f57606d..8f360ac 100644
--- a/doc/emacs/dired.texi
+++ b/doc/emacs/dired.texi
@@ -865,10 +865,14 @@ Operating on Files
 @command{compress}.  On a directory name, this command produces a
 compressed @file{.tar.gz} archive containing all of the directory's
 files, by running the @command{tar} command with output piped to
-@command{gzip}.  To allow decompression of compressed directories,
-typing @kbd{Z} on a @file{.tar.gz} or @file{.tgz} archive file unpacks
-all the files in the archive into a directory whose name is the
-archive name with the extension removed.
+@command{gzip}; if the value of the variable
+@code{dired-compress-files-default-suffix} is non-@code{nil}, a
+suitable command line will be pick up from
+@code{dired-compress-files-alist} to compress the directory.  To allow
+decompression of compressed directories, typing @kbd{Z} on a
+@file{.tar.gz} or @file{.tgz} archive file unpacks all the files in
+the archive into a directory whose name is the archive name with the
+extension removed.
 
 @findex dired-do-compress-to
 @kindex c @r{(Dired)}
diff --git a/etc/NEWS b/etc/NEWS
index fa8784d..e20beee 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -635,6 +635,12 @@ line, and allows truncating them (to preserve space on the mode line)
 or showing them literally, either instead of, or in addition to,
 displaying "by name" or "by date" sort order.
 
++++
+*** 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.
+
 ---
 *** Broken and circular links are shown with the 'dired-broken-symlink' face.
 
diff --git a/lisp/dired-aux.el b/lisp/dired-aux.el
index d5f4910..296c9fb 100644
--- a/lisp/dired-aux.el
+++ b/lisp/dired-aux.el
@@ -1132,6 +1132,7 @@ dired-compress-file-suffixes
     ;; Solaris 10 version of tar (obsolete in 2024?).
     ;; Same thing on AIX 7.1 (obsolete 2023?) and 7.2 (obsolete 2022?).
     ("\\.tar\\.gz\\'" "" "gzip -dc %i | tar -xf -")
+    ("\\.tar\\.xz\\'" "" "xz -dc %i | tar -xf -")
     ("\\.tgz\\'" "" "gzip -dc %i | tar -xf -")
     ("\\.gz\\'" "" "gunzip")
     ("\\.lz\\'" "" "lzip -d")
@@ -1149,10 +1150,7 @@ dired-compress-file-suffixes
     ("\\.zst\\'" "" "unzstd --rm")
     ("\\.7z\\'" "" "7z x -aoa -o%o %i")
     ;; This item controls naming for compression.
-    ("\\.tar\\'" ".tgz" nil)
-    ;; 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))
   "Control changes in file name suffixes for compression and uncompression.
 Each element specifies one transformation rule, and has the form:
   (REGEXP NEW-SUFFIX PROGRAM)
@@ -1168,6 +1166,14 @@ dired-compress-file-suffixes
 Otherwise, the rule is a compression rule, and compression is done with gzip.
 ARGS are command switches passed to PROGRAM.")
 
+(defcustom dired-compress-files-default-suffix nil
+  "Default suffix for compressing directory.
+If nil, the \".tar.gz\" will be used.  See `dired-compress-files-alist' for \
+the supported suffixes list."
+  :type 'string
+  :group 'dired
+  :version "28.1")
+
 (defvar dired-compress-files-alist
   '(("\\.tar\\.gz\\'" . "tar -cf - %i | gzip -c9 > %o")
     ("\\.tar\\.bz2\\'" . "tar -cf - %i | bzip2 -c9 > %o")
@@ -1275,20 +1281,28 @@ dired-compress-file
            ;; Try gzip; if we don't have that, use compress.
            (condition-case nil
                (if (file-directory-p file)
-                   (progn
-                     (setq suffix (cdr (assoc "\000" dired-compress-file-suffixes)))
-                     (when suffix
-                       (let ((out-name (concat file (car suffix)))
-                             (default-directory (file-name-directory file)))
-                         (dired-shell-command
-                          (replace-regexp-in-string
-                           "%o" (shell-quote-argument out-name)
-                           (replace-regexp-in-string
-                            "%i" (shell-quote-argument (file-name-nondirectory file))
-                            (cadr suffix)
-                            nil t)
-                           nil t))
-                         out-name)))
+                   (let* ((suffix
+                           (or dired-compress-files-default-suffix ".tar.gz"))
+                          (rule (cl-find-if
+                                 (lambda (x) (string-match-p (car x) suffix))
+                                 dired-compress-files-alist)))
+                     (if rule
+                         (let ((out-name (concat file suffix))
+                               (default-directory (file-name-directory file)))
+                           (dired-shell-command
+                            (replace-regexp-in-string
+                             "%o" (shell-quote-argument out-name)
+                             (replace-regexp-in-string
+                              "%i" (shell-quote-argument (file-name-nondirectory file))
+                              (cdr rule)
+                              nil t)
+                             nil t))
+                           out-name)
+                       (user-error
+                        "No compression rule found for \
+`dired-compress-files-default-suffix' %s, see `dired-compress-files-alist' for\
+ the supported suffixes list."
+                        dired-compress-files-default-suffix)))
                  (let ((out-name (concat file ".gz")))
                    (and (or (not (file-exists-p out-name))
                             (y-or-n-p
-- 
2.7.0


^ permalink raw reply related	[flat|nested] 18+ messages in thread

* bug#47119: Re: bug#47119: 28.0.50; [patch][Dired] new user option for compressing dir suffix
  2021-03-13  3:55 bug#47119: 28.0.50; [patch][Dired] new user option for compressing dir suffix Lin Sun via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2021-03-13  7:37 ` Eli Zaretskii
@ 2021-03-18 15:41 ` Lin Sun via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2021-04-02  0:57   ` Sun Lin via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2021-03-18 15:41 ` bug#47119: " Lin Sun via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2 siblings, 1 reply; 18+ messages in thread
From: Lin Sun via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2021-03-18 15:41 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: sunlin, 47119@debbugs.gnu.org

[-- Attachment #1: Type: text/html, Size: 1875 bytes --]

[-- Attachment #2: 0001-dired-new-user-option-dired-compress-files-default-s.patch --]
[-- Type: application/octet-stream, Size: 6347 bytes --]

From e7d8f160784d16d641d7e719b941a427b11126d9 Mon Sep 17 00:00:00 2001
From: Lin Sun <lin.sun@zoom.us>
Date: Sat, 13 Mar 2021 11:47:23 +0800
Subject: [PATCH] [*dired] new user option
 'dired-compress-files-default-suffix'

*dired-aux.el: user option 'dired-compress-files-default-suffix' for
default suffix for compressing directory.
---
 doc/emacs/dired.texi | 12 ++++++++----
 etc/NEWS             |  6 ++++++
 lisp/dired-aux.el    | 50 ++++++++++++++++++++++++++++++++------------------
 3 files changed, 46 insertions(+), 22 deletions(-)

diff --git a/doc/emacs/dired.texi b/doc/emacs/dired.texi
index f57606d..8f360ac 100644
--- a/doc/emacs/dired.texi
+++ b/doc/emacs/dired.texi
@@ -865,10 +865,14 @@ Operating on Files
 @command{compress}.  On a directory name, this command produces a
 compressed @file{.tar.gz} archive containing all of the directory's
 files, by running the @command{tar} command with output piped to
-@command{gzip}.  To allow decompression of compressed directories,
-typing @kbd{Z} on a @file{.tar.gz} or @file{.tgz} archive file unpacks
-all the files in the archive into a directory whose name is the
-archive name with the extension removed.
+@command{gzip}; if the value of the variable
+@code{dired-compress-files-default-suffix} is non-@code{nil}, a
+suitable command line will be pick up from
+@code{dired-compress-files-alist} to compress the directory.  To allow
+decompression of compressed directories, typing @kbd{Z} on a
+@file{.tar.gz} or @file{.tgz} archive file unpacks all the files in
+the archive into a directory whose name is the archive name with the
+extension removed.
 
 @findex dired-do-compress-to
 @kindex c @r{(Dired)}
diff --git a/etc/NEWS b/etc/NEWS
index fa8784d..e20beee 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -635,6 +635,12 @@ line, and allows truncating them (to preserve space on the mode line)
 or showing them literally, either instead of, or in addition to,
 displaying "by name" or "by date" sort order.
 
++++
+*** 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.
+
 ---
 *** Broken and circular links are shown with the 'dired-broken-symlink' face.
 
diff --git a/lisp/dired-aux.el b/lisp/dired-aux.el
index d5f4910..296c9fb 100644
--- a/lisp/dired-aux.el
+++ b/lisp/dired-aux.el
@@ -1132,6 +1132,7 @@ dired-compress-file-suffixes
     ;; Solaris 10 version of tar (obsolete in 2024?).
     ;; Same thing on AIX 7.1 (obsolete 2023?) and 7.2 (obsolete 2022?).
     ("\\.tar\\.gz\\'" "" "gzip -dc %i | tar -xf -")
+    ("\\.tar\\.xz\\'" "" "xz -dc %i | tar -xf -")
     ("\\.tgz\\'" "" "gzip -dc %i | tar -xf -")
     ("\\.gz\\'" "" "gunzip")
     ("\\.lz\\'" "" "lzip -d")
@@ -1149,10 +1150,7 @@ dired-compress-file-suffixes
     ("\\.zst\\'" "" "unzstd --rm")
     ("\\.7z\\'" "" "7z x -aoa -o%o %i")
     ;; This item controls naming for compression.
-    ("\\.tar\\'" ".tgz" nil)
-    ;; 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))
   "Control changes in file name suffixes for compression and uncompression.
 Each element specifies one transformation rule, and has the form:
   (REGEXP NEW-SUFFIX PROGRAM)
@@ -1168,6 +1166,14 @@ dired-compress-file-suffixes
 Otherwise, the rule is a compression rule, and compression is done with gzip.
 ARGS are command switches passed to PROGRAM.")
 
+(defcustom dired-compress-files-default-suffix nil
+  "Default suffix for compressing directory.
+If nil, the \".tar.gz\" will be used.  See `dired-compress-files-alist' for \
+the supported suffixes list."
+  :type 'string
+  :group 'dired
+  :version "28.1")
+
 (defvar dired-compress-files-alist
   '(("\\.tar\\.gz\\'" . "tar -cf - %i | gzip -c9 > %o")
     ("\\.tar\\.bz2\\'" . "tar -cf - %i | bzip2 -c9 > %o")
@@ -1275,20 +1281,28 @@ dired-compress-file
            ;; Try gzip; if we don't have that, use compress.
            (condition-case nil
                (if (file-directory-p file)
-                   (progn
-                     (setq suffix (cdr (assoc "\000" dired-compress-file-suffixes)))
-                     (when suffix
-                       (let ((out-name (concat file (car suffix)))
-                             (default-directory (file-name-directory file)))
-                         (dired-shell-command
-                          (replace-regexp-in-string
-                           "%o" (shell-quote-argument out-name)
-                           (replace-regexp-in-string
-                            "%i" (shell-quote-argument (file-name-nondirectory file))
-                            (cadr suffix)
-                            nil t)
-                           nil t))
-                         out-name)))
+                   (let* ((suffix
+                           (or dired-compress-files-default-suffix ".tar.gz"))
+                          (rule (cl-find-if
+                                 (lambda (x) (string-match-p (car x) suffix))
+                                 dired-compress-files-alist)))
+                     (if rule
+                         (let ((out-name (concat file suffix))
+                               (default-directory (file-name-directory file)))
+                           (dired-shell-command
+                            (replace-regexp-in-string
+                             "%o" (shell-quote-argument out-name)
+                             (replace-regexp-in-string
+                              "%i" (shell-quote-argument (file-name-nondirectory file))
+                              (cdr rule)
+                              nil t)
+                             nil t))
+                           out-name)
+                       (user-error
+                        "No compression rule found for \
+`dired-compress-files-default-suffix' %s, see `dired-compress-files-alist' for\
+ the supported suffixes list."
+                        dired-compress-files-default-suffix)))
                  (let ((out-name (concat file ".gz")))
                    (and (or (not (file-exists-p out-name))
                             (y-or-n-p
-- 
2.7.0


^ permalink raw reply related	[flat|nested] 18+ messages in thread

* bug#47119: 28.0.50; [patch][Dired] new user option for compressing dir suffix
  2021-03-18 15:41 ` bug#47119: " Lin Sun via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2021-03-20 10:37   ` Eli Zaretskii
  2021-03-22 12:28     ` LinSun via Bug reports for GNU Emacs, the Swiss army knife of text editors
  0 siblings, 1 reply; 18+ messages in thread
From: Eli Zaretskii @ 2021-03-20 10:37 UTC (permalink / raw)
  To: Lin Sun; +Cc: sunlin7, 47119

> 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.





^ permalink raw reply	[flat|nested] 18+ messages in thread

* bug#47119: 28.0.50; [patch][Dired] new user option for compressing dir suffix
  2021-03-20 10:37   ` Eli Zaretskii
@ 2021-03-22 12:28     ` LinSun via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2021-03-22 17:43       ` Eli Zaretskii
  0 siblings, 1 reply; 18+ messages in thread
From: LinSun via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2021-03-22 12:28 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: sunlin7@yahoo.com, 47119@debbugs.gnu.org

[-- Attachment #1: Type: text/html, Size: 4871 bytes --]

^ permalink raw reply	[flat|nested] 18+ messages in thread

* bug#47119: 28.0.50; [patch][Dired] new user option for compressing dir suffix
  2021-03-22 12:28     ` LinSun via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2021-03-22 17:43       ` Eli Zaretskii
  2021-03-23  3:00         ` LinSun via Bug reports for GNU Emacs, the Swiss army knife of text editors
  0 siblings, 1 reply; 18+ messages in thread
From: Eli Zaretskii @ 2021-03-22 17:43 UTC (permalink / raw)
  To: LinSun; +Cc: sunlin7, 47119

> Date: Mon, 22 Mar 2021 20:28:48 +0800
> From: LinSun <lin.sun@zoom.us>
> Cc: "47119@debbugs.gnu.org" <47119@debbugs.gnu.org>, 
> 	"sunlin7@yahoo.com" <sunlin7@yahoo.com>
> 
> >> -    ("\000" ".tar.gz" "tar -cf - %i | gzip -c9 > %o"))
> 
> >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?
> 
> The “\000” entry is special for compress directory, if you go through back, other entries in the
> `dired-compress-file-suffixes` is decompress commands. After apply this patch, the “\000” entry is useless.

I'm still missing something, I think.  Please describe step by step
how compressing a directory will work after your changes, and in
particular what shell command(s) will Dired run in that case.

Thanks.





^ permalink raw reply	[flat|nested] 18+ messages in thread

* bug#47119: 28.0.50; [patch][Dired] new user option for compressing dir suffix
  2021-03-22 17:43       ` Eli Zaretskii
@ 2021-03-23  3:00         ` LinSun via Bug reports for GNU Emacs, the Swiss army knife of text editors
  0 siblings, 0 replies; 18+ messages in thread
From: LinSun via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2021-03-23  3:00 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: sunlin7@yahoo.com, 47119@debbugs.gnu.org

[-- Attachment #1: Type: text/html, Size: 3049 bytes --]

^ permalink raw reply	[flat|nested] 18+ messages in thread

* bug#47119: 28.0.50; [patch][Dired] new user option for compressing dir suffix
  2021-03-18 15:41 ` bug#47119: " Lin Sun via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2021-04-02  0:57   ` Sun Lin via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2021-05-17 16:04     ` Lars Ingebrigtsen
  0 siblings, 1 reply; 18+ messages in thread
From: Sun Lin via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2021-04-02  0:57 UTC (permalink / raw)
  To: Eli Zaretskii, Lin Sun; +Cc: 47119


[-- Attachment #1.1: Type: text/plain, Size: 1371 bytes --]

 There is another user option `compress-file-default-suffix` that allow user custom default suffix for compressing file in dired-mode.

These two patch allow user custom suffix for compressing folder and file in dired-mode by pressing "Z".

Both two patches are attached.     On Tuesday, March 23, 2021, 11:16:13 PM GMT+8, Lin Sun <lin.sun@zoom.us> wrote:  
 
 #yiv1694401698 #yiv1694401698 -- filtered {}#yiv1694401698 filtered {}#yiv1694401698 filtered {}#yiv1694401698 filtered {}#yiv1694401698 p.yiv1694401698MsoNormal, #yiv1694401698 li.yiv1694401698MsoNormal, #yiv1694401698 div.yiv1694401698MsoNormal {margin:0in;margin-bottom:.0001pt;font-size:11.0pt;font-family:sans-serif;}#yiv1694401698 .yiv1694401698MsoChpDefault {}#yiv1694401698 filtered {}#yiv1694401698 div.yiv1694401698WordSection1 {}#yiv1694401698 
Hi Eli,

  

Sorry for my misunderstanding for your preview comments.

  

> 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.

  

And yes, the document need update, changes are available in the attachment.

  

Please help to review the new patch. Thanks.
  

[-- Attachment #1.2: Type: text/html, Size: 2384 bytes --]

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-dired-new-user-option-dired-compress-files-default-s.patch --]
[-- Type: text/x-patch, Size: 5100 bytes --]

From 1a55db2623e9cdb3d55c538a2518178cc6b280f9 Mon Sep 17 00:00:00 2001
From: Lin Sun <lin.sun@zoom.us>
Date: Sat, 13 Mar 2021 11:47:23 +0800
Subject: [PATCH 1/2] [*dired] new user option
 'dired-compress-files-default-suffix'

*dired-aux.el: user option 'dired-compress-files-default-suffix' for
default suffix for compressing directory.
---
 etc/NEWS          |  6 ++++++
 lisp/dired-aux.el | 49 +++++++++++++++++++++++++++++++------------------
 2 files changed, 37 insertions(+), 18 deletions(-)

diff --git a/etc/NEWS b/etc/NEWS
index fa8784d..e20beee 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -635,6 +635,12 @@ line, and allows truncating them (to preserve space on the mode line)
 or showing them literally, either instead of, or in addition to,
 displaying "by name" or "by date" sort order.
 
++++
+*** 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.
+
 ---
 *** Broken and circular links are shown with the 'dired-broken-symlink' face.
 
diff --git a/lisp/dired-aux.el b/lisp/dired-aux.el
index d5f4910..237182e 100644
--- a/lisp/dired-aux.el
+++ b/lisp/dired-aux.el
@@ -1132,6 +1132,7 @@ dired-compress-file-suffixes
     ;; Solaris 10 version of tar (obsolete in 2024?).
     ;; Same thing on AIX 7.1 (obsolete 2023?) and 7.2 (obsolete 2022?).
     ("\\.tar\\.gz\\'" "" "gzip -dc %i | tar -xf -")
+    ("\\.tar\\.xz\\'" "" "xz -dc %i | tar -xf -")
     ("\\.tgz\\'" "" "gzip -dc %i | tar -xf -")
     ("\\.gz\\'" "" "gunzip")
     ("\\.lz\\'" "" "lzip -d")
@@ -1149,10 +1150,7 @@ dired-compress-file-suffixes
     ("\\.zst\\'" "" "unzstd --rm")
     ("\\.7z\\'" "" "7z x -aoa -o%o %i")
     ;; This item controls naming for compression.
-    ("\\.tar\\'" ".tgz" nil)
-    ;; 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))
   "Control changes in file name suffixes for compression and uncompression.
 Each element specifies one transformation rule, and has the form:
   (REGEXP NEW-SUFFIX PROGRAM)
@@ -1168,6 +1166,13 @@ dired-compress-file-suffixes
 Otherwise, the rule is a compression rule, and compression is done with gzip.
 ARGS are command switches passed to PROGRAM.")
 
+(defcustom dired-compress-files-default-suffix nil
+  "Default suffix for compressing directory.
+If nil, the \".tar.gz\" will be used."
+  :type 'string
+  :group 'dired
+  :version "28.1")
+
 (defvar dired-compress-files-alist
   '(("\\.tar\\.gz\\'" . "tar -cf - %i | gzip -c9 > %o")
     ("\\.tar\\.bz2\\'" . "tar -cf - %i | bzip2 -c9 > %o")
@@ -1275,20 +1280,28 @@ dired-compress-file
            ;; Try gzip; if we don't have that, use compress.
            (condition-case nil
                (if (file-directory-p file)
-                   (progn
-                     (setq suffix (cdr (assoc "\000" dired-compress-file-suffixes)))
-                     (when suffix
-                       (let ((out-name (concat file (car suffix)))
-                             (default-directory (file-name-directory file)))
-                         (dired-shell-command
-                          (replace-regexp-in-string
-                           "%o" (shell-quote-argument out-name)
-                           (replace-regexp-in-string
-                            "%i" (shell-quote-argument (file-name-nondirectory file))
-                            (cadr suffix)
-                            nil t)
-                           nil t))
-                         out-name)))
+                   (let* ((suffix
+                           (or dired-compress-files-default-suffix ".tar.gz"))
+                          (rule (cl-find-if
+                                 (lambda (x) (string-match-p (car x) suffix))
+                                 dired-compress-files-alist)))
+                     (if rule
+                         (let ((out-name (concat file suffix))
+                               (default-directory (file-name-directory file)))
+                           (dired-shell-command
+                            (replace-regexp-in-string
+                             "%o" (shell-quote-argument out-name)
+                             (replace-regexp-in-string
+                              "%i" (shell-quote-argument (file-name-nondirectory file))
+                              (cdr rule)
+                              nil t)
+                             nil t))
+                           out-name)
+                       (user-error
+                        "No compression rule found for \
+`dired-compress-files-default-suffix' %s, see `dired-compress-files-alist' for\
+ the supported suffixes list."
+                        dired-compress-files-default-suffix)))
                  (let ((out-name (concat file ".gz")))
                    (and (or (not (file-exists-p out-name))
                             (y-or-n-p
-- 
2.7.0


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #3: 0002-dired-new-user-option-dired-compress-file-default-su.patch --]
[-- Type: text/x-patch, Size: 5423 bytes --]

From 0dc4c7b00573c7baa4f4c5848810599f81ac6f5c Mon Sep 17 00:00:00 2001
From: Lin Sun <lin.sun@zoom.us>
Date: Mon, 15 Mar 2021 09:43:54 +0800
Subject: [PATCH 2/2] [*dired] new user option
 'dired-compress-file-default-suffix'

*dired-aux.el: user option 'dired-compress-file-default-suffix' for
default suffix for compressing file in dired-mode.
---
 etc/NEWS          |  6 +++++
 lisp/dired-aux.el | 68 +++++++++++++++++++++++++++++++++++++++++--------------
 2 files changed, 57 insertions(+), 17 deletions(-)

diff --git a/etc/NEWS b/etc/NEWS
index e20beee..340538d 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -641,6 +641,12 @@ 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.
 
++++
+*** New user option 'dired-compress-file-default-suffix'.
+This user option controls default suffix for compressing files.  If it's
+nil, the ".gz" will be used. Refer the 'dired-compress-file-alist' for
+supported suffix list.
+
 ---
 *** Broken and circular links are shown with the 'dired-broken-symlink' face.
 
diff --git a/lisp/dired-aux.el b/lisp/dired-aux.el
index 237182e..c1f51a5 100644
--- a/lisp/dired-aux.el
+++ b/lisp/dired-aux.el
@@ -1166,6 +1166,27 @@ dired-compress-file-suffixes
 Otherwise, the rule is a compression rule, and compression is done with gzip.
 ARGS are command switches passed to PROGRAM.")
 
+(defcustom dired-compress-file-default-suffix nil
+  "Default suffix for compressing single file.
+If nil, the \".gz\" will be used."
+  :type 'string
+  :group 'dired
+  :version "28.1")
+
+(defvar dired-compress-file-alist
+  '(("\\.gz\\'" . "gzip -9f %i")
+    ("\\.bz2\\'" . "bzip2 -9f %i")
+    ("\\.xz\\'" . "xz -9f %i")
+    ("\\.zst\\'" . "zstd -qf -19 --rm -o %o %i"))
+  "Control the compression shell command for `dired-do-compress-to'.
+
+Each element is (REGEXP . CMD), where REGEXP is the name of the
+archive to which you want to compress, and CMD is the
+corresponding command.
+
+Within CMD, %i denotes the input file(s), and %o denotes the
+output file. %i path(s) are relative, while %o is absolute.")
+
 (defcustom dired-compress-files-default-suffix nil
   "Default suffix for compressing directory.
 If nil, the \".tar.gz\" will be used."
@@ -1302,23 +1323,36 @@ dired-compress-file
 `dired-compress-files-default-suffix' %s, see `dired-compress-files-alist' for\
  the supported suffixes list."
                         dired-compress-files-default-suffix)))
-                 (let ((out-name (concat file ".gz")))
-                   (and (or (not (file-exists-p out-name))
-                            (y-or-n-p
-                             (format "File %s already exists.  Really compress? "
-                                     out-name)))
-                        (not
-                         (dired-check-process (concat "Compressing " file)
-                                              "gzip" "-f" file))
-                        (or (file-exists-p out-name)
-                            (setq out-name (concat file ".z")))
-                        ;; Rename the compressed file to NEWNAME
-                        ;; if it hasn't got that name already.
-                        (if (and newname (not (equal newname out-name)))
-                            (progn
-                              (rename-file out-name newname t)
-                              newname)
-                          out-name))))
+                 (let* ((suffix (or dired-compress-file-default-suffix ".gz"))
+                        (out-name (concat file suffix))
+                        (rule (cl-find-if
+                               (lambda (x) (string-match-p (car x) suffix))
+                               dired-compress-file-alist)))
+                   (if (not rule)
+                       (user-error "No compression rule found for suffix %s, \
+see `dired-compress-file-alist' for the supported suffixes list."
+                                   dired-compress-file-default-suffix)
+                     (and (or (not (file-exists-p out-name))
+                              (y-or-n-p
+                               (format "File %s already exists.  Really compress? "
+                                       out-name)))
+                          (dired-shell-command
+                           (replace-regexp-in-string
+                            "%o" (shell-quote-argument out-name)
+                            (replace-regexp-in-string
+                             "%i" (shell-quote-argument (file-name-nondirectory file))
+                             (cdr rule)
+                             nil t)
+                            nil t))
+                          (or (file-exists-p out-name)
+                              (setq out-name (concat file ".z")))
+                          ;; Rename the compressed file to NEWNAME
+                          ;; if it hasn't got that name already.
+                          (if (and newname (not (equal newname out-name)))
+                              (progn
+                                (rename-file out-name newname t)
+                                newname)
+                            out-name)))))
              (file-error
               (if (not (dired-check-process (concat "Compressing " file)
                                             "compress" "-f" file))
-- 
2.7.0


^ permalink raw reply related	[flat|nested] 18+ messages in thread

* bug#47119: 28.0.50; [patch][Dired] new user option for compressing dir suffix
  2021-04-02  0:57   ` Sun Lin via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2021-05-17 16:04     ` Lars Ingebrigtsen
  2021-05-18  1:21       ` Sun Lin via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2021-05-18 14:55       ` Glenn Morris
  0 siblings, 2 replies; 18+ messages in thread
From: Lars Ingebrigtsen @ 2021-05-17 16:04 UTC (permalink / raw)
  To: Sun Lin; +Cc: 47119, Lin Sun

Sun Lin <sunlin7@yahoo.com> writes:

> There is another user option `compress-file-default-suffix` that allow user custom
> default suffix for compressing file in dired-mode.
>
> These two patch allow user custom suffix for compressing folder and file in
> dired-mode by pressing "Z".
>
> Both two patches are attached. 

Thanks; applied to Emacs 28 with some small changes.

I'm not quite sure I understood the \000 change, but in testing, things
seem to work fine for me.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no





^ permalink raw reply	[flat|nested] 18+ messages in thread

* bug#47119: 28.0.50; [patch][Dired] new user option for compressing dir suffix
  2021-05-17 16:04     ` Lars Ingebrigtsen
@ 2021-05-18  1:21       ` Sun Lin via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2021-05-18 14:55       ` Glenn Morris
  1 sibling, 0 replies; 18+ messages in thread
From: Sun Lin via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2021-05-18  1:21 UTC (permalink / raw)
  To: Lars Ingebrigtsen; +Cc: Eli Zaretskii, 47119@debbugs.gnu.org, Lin Sun

[-- Attachment #1: Type: text/plain, Size: 876 bytes --]

Hi Lars,

Great, thank you! : )

Best Regards
Lin Sun
From: Lars Ingebrigtsen
Sent: Tuesday, May 18, 2021 00:05
To: Sun Lin
Cc: Eli Zaretskii; Lin Sun; 47119@debbugs.gnu.org
Subject: Re: bug#47119: 28.0.50; [patch][Dired] new user option for compressing dir suffix

Sun Lin <sunlin7@yahoo.com> writes:

> There is another user option `compress-file-default-suffix` that allow user custom
> default suffix for compressing file in dired-mode.
>
> These two patch allow user custom suffix for compressing folder and file in
> dired-mode by pressing "Z".
>
> Both two patches are attached. 

Thanks; applied to Emacs 28 with some small changes.

I'm not quite sure I understood the \000 change, but in testing, things
seem to work fine for me.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no


[-- Attachment #2: Type: text/html, Size: 3260 bytes --]

^ permalink raw reply	[flat|nested] 18+ messages in thread

* bug#47119: 28.0.50; [patch][Dired] new user option for compressing dir suffix
  2021-05-17 16:04     ` Lars Ingebrigtsen
  2021-05-18  1:21       ` Sun Lin via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2021-05-18 14:55       ` Glenn Morris
  2021-05-18 15:49         ` Lars Ingebrigtsen
  2021-05-19 15:47         ` Glenn Morris
  1 sibling, 2 replies; 18+ messages in thread
From: Glenn Morris @ 2021-05-18 14:55 UTC (permalink / raw)
  To: Lars Ingebrigtsen; +Cc: Sun Lin, Lin Sun, 47119

Lars Ingebrigtsen wrote:

> [...] in testing, things seem to work fine for me.

files-tests-file-name-non-special-dired-compress-handler
fails since dac20f08. Ref eg https://hydra.nixos.org/build/143251935
Reproduced on CentOS 8.3.





^ permalink raw reply	[flat|nested] 18+ messages in thread

* bug#47119: 28.0.50; [patch][Dired] new user option for compressing dir suffix
  2021-05-18 14:55       ` Glenn Morris
@ 2021-05-18 15:49         ` Lars Ingebrigtsen
  2021-05-19  0:12           ` Sun Lin via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2021-05-19 15:47         ` Glenn Morris
  1 sibling, 1 reply; 18+ messages in thread
From: Lars Ingebrigtsen @ 2021-05-18 15:49 UTC (permalink / raw)
  To: Glenn Morris; +Cc: Sun Lin, Lin Sun, 47119

Glenn Morris <rgm@gnu.org> writes:

> Lars Ingebrigtsen wrote:
>
>> [...] in testing, things seem to work fine for me.
>
> files-tests-file-name-non-special-dired-compress-handler
> fails since dac20f08. Ref eg https://hydra.nixos.org/build/143251935
> Reproduced on CentOS 8.3.

Thanks; this should now be fixed.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no





^ permalink raw reply	[flat|nested] 18+ messages in thread

* bug#47119: 28.0.50; [patch][Dired] new user option for compressing dir suffix
  2021-05-18 15:49         ` Lars Ingebrigtsen
@ 2021-05-19  0:12           ` Sun Lin via Bug reports for GNU Emacs, the Swiss army knife of text editors
  0 siblings, 0 replies; 18+ messages in thread
From: Sun Lin via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2021-05-19  0:12 UTC (permalink / raw)
  To: Glenn Morris, Lars Ingebrigtsen
  Cc: Eli Zaretskii, 47119@debbugs.gnu.org, Lin Sun

Hi Lars, Glenn,

Thank you so much, it's my failed, glad it's fixed now. 


Best Regards

On Tuesday, May 18, 2021, 03:49:36 PM UTC, Lars Ingebrigtsen <larsi@gnus.org> wrote: 

Glenn Morris <rgm@gnu.org> writes:


> Lars Ingebrigtsen wrote:
>
>> [...] in testing, things seem to work fine for me.
>
> files-tests-file-name-non-special-dired-compress-handler
> fails since dac20f08. Ref eg https://hydra.nixos.org/build/143251935
> Reproduced on CentOS 8.3.


Thanks; this should now be fixed.

-- 
(domestic pets only, the antidote for overdose, milk.)
  bloggy blog: http://lars.ingebrigtsen.no






^ permalink raw reply	[flat|nested] 18+ messages in thread

* bug#47119: 28.0.50; [patch][Dired] new user option for compressing dir suffix
  2021-05-18 14:55       ` Glenn Morris
  2021-05-18 15:49         ` Lars Ingebrigtsen
@ 2021-05-19 15:47         ` Glenn Morris
  2021-05-20 10:20           ` LinSun via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2021-05-25  4:56           ` Lars Ingebrigtsen
  1 sibling, 2 replies; 18+ messages in thread
From: Glenn Morris @ 2021-05-19 15:47 UTC (permalink / raw)
  To: Lars Ingebrigtsen; +Cc: Sun Lin, Lin Sun, 47119


I also wonder how useful it is to say eg "the default nil means .tar"
rather than just making the default value be ".tar"?
(Spotted because the custom :type did not allow for nil.)





^ permalink raw reply	[flat|nested] 18+ messages in thread

* bug#47119: 28.0.50; [patch][Dired] new user option for compressing dir suffix
  2021-05-19 15:47         ` Glenn Morris
@ 2021-05-20 10:20           ` LinSun via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2021-05-25  4:56           ` Lars Ingebrigtsen
  1 sibling, 0 replies; 18+ messages in thread
From: LinSun via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2021-05-20 10:20 UTC (permalink / raw)
  To: Glenn Morris, Lars Ingebrigtsen
  Cc: Sun Lin, Eli Zaretskii, 47119@debbugs.gnu.org

[-- Attachment #1: Type: text/html, Size: 2606 bytes --]

^ permalink raw reply	[flat|nested] 18+ messages in thread

* bug#47119: 28.0.50; [patch][Dired] new user option for compressing dir suffix
  2021-05-19 15:47         ` Glenn Morris
  2021-05-20 10:20           ` LinSun via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2021-05-25  4:56           ` Lars Ingebrigtsen
  1 sibling, 0 replies; 18+ messages in thread
From: Lars Ingebrigtsen @ 2021-05-25  4:56 UTC (permalink / raw)
  To: Glenn Morris; +Cc: Sun Lin, Lin Sun, 47119

Glenn Morris <rgm@gnu.org> writes:

> I also wonder how useful it is to say eg "the default nil means .tar"
> rather than just making the default value be ".tar"?
> (Spotted because the custom :type did not allow for nil.)

Yes, defaulting to .tar/.gz in these two variables does sound more regular.

LinSun <lin.sun@zoom.us> writes:

> The nil is useful for distinguish default value from custom setting value.

You can have non-nil default values -- the defcustom machinery keeps
track of what the defaults are.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no





^ permalink raw reply	[flat|nested] 18+ messages in thread

end of thread, other threads:[~2021-05-25  4:56 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-13  3:55 bug#47119: 28.0.50; [patch][Dired] new user option for compressing dir suffix Lin Sun via Bug reports for GNU Emacs, the Swiss army knife of text editors
2021-03-13  7:37 ` Eli Zaretskii
2021-03-13  7:50   ` Lin Sun via Bug reports for GNU Emacs, the Swiss army knife of text editors
2021-03-18 15:41 ` bug#47119: " Lin Sun via Bug reports for GNU Emacs, the Swiss army knife of text editors
2021-04-02  0:57   ` Sun Lin via Bug reports for GNU Emacs, the Swiss army knife of text editors
2021-05-17 16:04     ` Lars Ingebrigtsen
2021-05-18  1:21       ` Sun Lin via Bug reports for GNU Emacs, the Swiss army knife of text editors
2021-05-18 14:55       ` Glenn Morris
2021-05-18 15:49         ` Lars Ingebrigtsen
2021-05-19  0:12           ` Sun Lin via Bug reports for GNU Emacs, the Swiss army knife of text editors
2021-05-19 15:47         ` Glenn Morris
2021-05-20 10:20           ` LinSun via Bug reports for GNU Emacs, the Swiss army knife of text editors
2021-05-25  4:56           ` Lars Ingebrigtsen
2021-03-18 15:41 ` bug#47119: " Lin Sun via Bug reports for GNU Emacs, the Swiss army knife of text editors
2021-03-20 10:37   ` Eli Zaretskii
2021-03-22 12:28     ` LinSun via Bug reports for GNU Emacs, the Swiss army knife of text editors
2021-03-22 17:43       ` Eli Zaretskii
2021-03-23  3:00         ` LinSun via Bug reports for GNU Emacs, the Swiss army knife of text editors

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).