[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#13006: recognizing compressed files with arbitrary names
From: |
Karl Berry |
Subject: |
bug#13006: recognizing compressed files with arbitrary names |
Date: |
Tue, 27 Nov 2012 01:31:51 GMT |
As the documentation says
(http://www.gnu.org/software/emacs/manual/html_node/emacs/Compressed-Files.html)
"Emacs recognizes compressed files by their file names."
But compressed files don't always have the expected names. For
instance, using the autobackup feature of Emacs or many other programs
will result in names ending in, say, .~1~ ... Example for concreteness:
$ echo foo | gzip >/tmp/foo.gz.~1~
$ emacs --no-site-file --no-init /tmp/foo.gz.~1~
And observe binary junk instead of text. (This is with 24.2.)
Another implication is problems using M-x grep on such files. After
changing the program to zgrep from grep, matches in the *grep* buffer
are displayed as usual, but then when one visits the file in Emacs,
it's junk.
It would be nice to at least have an easy way to manually tell Emacs
"this is a compressed file, despite its weird name". If there's a way
to do that now, I'd like to know (and it should presumably be in the
manual). I looked at jka-compr.el but could not find it.
Of course, a more robust solution would be to use magic numbers instead
of filenames to recognize file types. I see there was a long thread
about that several years ago, starting at
http://lists.gnu.org/archive/html/emacs-devel/2009-08/msg01023.html. I
know it's been discussed at other times, too, but I can't see any way to
accomplish it (short of using crypt++, which doesn't work well with
Emacs 23 or later, which is why I stopped using it ... anyway).
Thanks,
karl
- bug#13006: recognizing compressed files with arbitrary names,
Karl Berry <=