unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: karl@freefriends.org (Karl Berry)
To: 13006@debbugs.gnu.org
Subject: bug#13006: recognizing compressed files with arbitrary names
Date: Tue, 27 Nov 2012 01:31:51 GMT	[thread overview]
Message-ID: <201211270131.qAR1VpBY005753@freefriends.org> (raw)

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





             reply	other threads:[~2012-11-27  1:31 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-11-27  1:31 Karl Berry [this message]
2012-11-27  8:50 ` bug#13006: recognizing compressed files with arbitrary names Andreas Schwab
2012-11-27 18:41   ` Glenn Morris
2012-11-27 23:04     ` Karl Berry
2012-11-28  8:39     ` Glenn Morris

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=201211270131.qAR1VpBY005753@freefriends.org \
    --to=karl@freefriends.org \
    --cc=13006@debbugs.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).