bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: don't assume ELF binaries are multicultural text


From: Kevin Rodgers
Subject: Re: don't assume ELF binaries are multicultural text
Date: Wed, 12 Jul 2006 10:44:08 -0600
User-agent: Thunderbird 1.5.0.4 (Windows/20060516)

Dan Jacobson wrote:
$ emacs /bin/sh
Loading thai-util...
Loading mule-util...done
Loading thai-util...done
Loading lao-util...done
Loading ind-util...done
Loading composite...done
Loading tibet-util...done

Got an idea, why not say "Uh, Holmes, /bin/sh is a ELF 32-bit LSB
executable, Intel 80386, version 1 (SYSV), for GNU/Linux 2.2.0,
dynamically linked (uses shared libs), for GNU/Linux 2.2.0, stripped,
shall we w: wrongly assume it is multicultural text, thus bloating
emacs for the remainder of the session, h: invoke some hex editing
mode, q: back out of your certainly mistaken attempt to open the wrong
file, f: forever allow me to blunder ahead as multicultural text next
time..."

(setq auto-coding-regexp-alist
      (cons '("\\`\177ELF" . no-conversion)
            auto-coding-regexp-alist))

You can find more interesting byte patterns in /etc/magic.

(setq auto-mode-alist
      (cons (cons "\\`/bin/[^/]+\\'" 'hexl-mode)
            auto-mode-alist))

You can find more directories with binary files in (getenv "PATH") or
load-path.

--
Kevin





reply via email to

[Prev in Thread] Current Thread [Next in Thread]