From: Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Subject: Re: automatically turn on hexl-mode
Date: Thu, 05 Jun 2003 17:27:38 +0200 [thread overview]
Message-ID: <m33cio4k9h.fsf@seneca.benny.turtle-trading.net> (raw)
In-Reply-To: 7i8yshfs8u.fsf@neoscale.com
Hi Kin,
Kin Cho <kin@neoscale.com> writes:
> In my find-file-hooks function, I want to turn on hexl-mode
> automatically based on content. I.e.,
>
> (and (buffer-content-looks-binary) (hexl-mode))
>
> What's a reasonable implementation of buffer-content-looks-binary?
<philosophical>
It's not easy to define formally what "binary" is. Is an MS Word
document binary? An UTF-16 document? A gzipped text file? And all
of these can be shown in Emacs, even though some of them need external
helpers. Also for some purposes the actual question behind "is it
binary?" may be different than for others. E.g. what CVS actually
needs to know is "Can I change the line ends and expand RCS keywords?"
</philosophical>
I recently had to find all binary files in a development project, a
collection of 13186 files. Several methods said that there were 897
binary files in between. The simplest and still reliable criterium
was to just look for a NUL byte in the first 1K of the file.
Hope this helps, benny
next prev parent reply other threads:[~2003-06-05 15:27 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-06-04 21:27 automatically turn on hexl-mode Kin Cho
2003-06-04 23:37 ` Pascal Bourguignon
2003-06-05 15:27 ` Benjamin Riefenstahl [this message]
2003-06-05 18:10 ` Kin Cho
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=m33cio4k9h.fsf@seneca.benny.turtle-trading.net \
--to=benjamin.riefenstahl@epost.de \
/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.
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).