Emacs has this very nice functionality that it automatically decompresses ".gz" / ".tar.gz" archives upon opening them (e.g. C-x f logs.gz).

I'd like to extend this functionality so Emacs also performs this for Zstd archives.

Can anyone point me in the direction towards which setting I need to customize? I'm sure it's just a add-to-list or add-hook away :-)

  • 2
    AFAIK (and I may not know enough - be forewarned), all you need to do is add the file suffix for such files to jka-compr-load-suffixes and add an entry to handle such files to jka-compr-compression-info-list. Do C-h v <variable> on each of these two variables and see what you need to do.
    – NickD
    May 26, 2023 at 14:24
  • 2
    Wich is your emacs version? In mine, 28.2 zstd archives are mentioned in jka-compr-compression-info-list. Make sure you have the correct compression and decompression programs available in exec-path.
    – matteol
    May 27, 2023 at 6:23

1 Answer 1


Thanks to @NickD and @matteol for pointing me in the direction of jka-compr-compression-info-list. In Emacs 28, this list indeed contains an entry for Zstandard archives, but only for file endings *.zst - hence my files named example.log.zstd were not picked up by Emacs. Since zst is the official file extension for Zstandard files (https://datatracker.ietf.org/doc/html/rfc8878), I'll fix the program that generated these "incorrectly" named files.

If anyone else still wants to add new file endings to the list, here's how to do it:

(add-to-list 'jka-compr-compression-info-list
              "zstd compressing" "zstd" ("-c", "-q")
              "zstd decompressing" "zstd" ("-c", "-q", "-d")
              nil t])

Based on the upstream implementation: https://github.com/emacs-mirror/emacs/blob/4b3de748b0b04407d2492500c77905de56de1180/lisp/jka-cmpr-hook.el#L257-L260

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.