16

I want to work easier with archives in Emacs dired-mode. And I think that my needs are not only mine.

What I want? Two things in Dired:

  1. z to zip file or dir on cursor (or all marked files/dirs if marks are exists); the name of new archive should be changeable (but if one file/dir selected than name should be the same);
  2. Z to unarchive any type of archives (zip or gz or tar) at cursor; by default content should be placed in new directory with the same name.

How can one achieve that?

5
  • @Drew, Z in Dired replace (not added another) file with it's *.gz archive (not *.zip).
    – drobnbobn
    Commented Mar 8, 2016 at 1:51
  • Yes. Apparently (now) that is not what you want. But you have not specified what you want. As I said, the question is not very clear. I suppose that for someone who is familiar with dired-atool, or who takes the time to follow the link and study what it does, the question will be clearer, but you should clarify the question itself, IMHO.
    – Drew
    Commented Mar 8, 2016 at 3:34
  • @Drew, I rewrite my question. Is it clearly now?
    – drobnbobn
    Commented Mar 8, 2016 at 3:47
  • 1
    This feature is coming up in the next emacs release (25.1) [Relevant commit]. If you wish, you can try the 3rd pretest (25.0.92) from here. Copying @abo-abo. Commented Mar 8, 2016 at 20:25
  • @Drew, sorry, it's my fault! Surely I mean "inside of Dired".
    – drobnbobn
    Commented Mar 9, 2016 at 0:37

1 Answer 1

17

emacs 25.x

The emacs 25.1 release will have in-built support for handling different kinds of archives from within dired. Below is the relevant excerpt from the NEWS file (C-h C-n).

+++
*** The command `dired-do-compress' bound to `Z' now can compress
directories and decompress zip files.

+++
*** New command `dired-do-compress-to' bound to `c' can be used to
compress many marked files into a single named archive.  The
compression command is determined from the new
`dired-compress-files-alist' variable.

dired-do-compress | Z

Check out the dired-compress-file-suffixes variable to get a list of supported compressed file formats. The correct program will be used to uncompress a file (or files) when using the Z binding (dired-do-compress).

While the above will uncompress a wide range of formats, it will always compress using gzip.

dired-do-compress-to | c

Check out the dired-compress-files-alist variable to get a list of supported file formats that can be compressed to using the c binding (dired-do-compress-to).

As of emacs 25.1, it supports compressing using tar + (gzip/bzip2/xz) or zip.

2
  • How to get Emacs 25.1? Or the 25.0.92 version is latest for now?
    – drobnbobn
    Commented Mar 10, 2016 at 12:34
  • 1
    @drobnbobn Emacs 25.1 isn't out yet, 25.0.92 is the latest beta. Commented Mar 10, 2016 at 12:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.