I’ve been seeing more and more bzip2-compressed files these days, and I want to be able to open these files in GNU Emacs without the need to decompress them.
About 10 years ago I copied someone’s
~/.emacs file and noticed some mention of a crypt++ module. I asked them what it did and they told me that it allowed them to view
*.gz files in an Emacs buffer by doing the decoding on-the-fly. Combined with the built-in support for
tar-mode, this is very handy.
I’ve been using it to browse
*.tgz files since the emacs-19.34 days, but today I needed to view the source code of
php-4.3.4.tar.bz2 and it didn’t work.
After a little bit of investigation, it turned out that the ancient version of crypt++.el I’ve been using for the past decade didn’t support bzip2 files. So I went and grabbed the latest version (2.92, released January 2003) and added the following 6 lines to my
(modify-coding-system-alist 'file "\\.gz\\'" 'no-conversion)
(modify-coding-system-alist 'file "\\.Z\\'" 'no-conversion)
(modify-coding-system-alist 'file "\\.gpg\\'" 'no-conversion)
(modify-coding-system-alist 'file "\\.bz\\'" 'no-conversion)
(modify-coding-system-alist 'file "\\.bz2\\'" 'no-conversion)
Viola! It works!
It turns out that GNU Emacs 20 and later has native support for handling compressed files, so all you really need is this:
But I’m still kinda attached to using crypt++ because I occasionally use the built-in PGP support.