unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#13006: recognizing compressed files with arbitrary names
@ 2012-11-27  1:31 Karl Berry
  2012-11-27  8:50 ` Andreas Schwab
  0 siblings, 1 reply; 5+ messages in thread
From: Karl Berry @ 2012-11-27  1:31 UTC (permalink / raw
  To: 13006

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





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

end of thread, other threads:[~2012-11-28  8:39 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-11-27  1:31 bug#13006: recognizing compressed files with arbitrary names Karl Berry
2012-11-27  8:50 ` Andreas Schwab
2012-11-27 18:41   ` Glenn Morris
2012-11-27 23:04     ` Karl Berry
2012-11-28  8:39     ` Glenn Morris

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