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

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

Re: reading binary, non-unix file


From: Daniel Pittman
Subject: Re: reading binary, non-unix file
Date: Sat, 23 Oct 2004 13:44:38 +1000
User-agent: Gnus/5.110003 (No Gnus v0.3) Emacs/21.3 (gnu/linux)

On 23 Oct 2004, Mickey Ferguson wrote:
> I'm using emacs 21.1.1 on Windows 2000 SP4, and I'm having trouble reading a
> file.  The file is a Dr. Watson crash dump.  Apparently it's got some binary
> characters in the file, causing emacs to think it's a Unix file, when it
> isn't.  When the file loads into Emacs, the mode line at the bottom says
> "(Unix)", and it displays a bunch of control character kinds of stuff.  If I
> just open the file in ordinary notepad, it views fine.
>
> Question 1: How do I load this file into emacs so that it's viewable, just
> like it is in notepad?  Of course I could open it in notepad, copy the
> entire buffer contents, and then paste it into an emacs buffer, but that's
> clunky.  I just want to be able to use ordinary find-file, or start up emacs
> directly with the file.  Alternatively, if loading it directly won't work,
> at least have some kind of function I can use so I can load it and
> edit.

The issue is one of character set detection, which you need to override
in this case.

You can do this by using the 'universal coding system' prefix to the
find-file command, by entering the following sequence:

   C-x RET c <coding system> RET C-x C-f <file>

Basically, C-x RET c runs `universal-coding-system-argument', which
prompts for a coding system, then uses that for the `find-file'
operation.

Picking something like latin-1-dos should give you what you want there,
by forcing the end-of-line convention as well, rather than relying on
the automatic detection.

> Question 2: How do I prevent emacs from ever loading in a file in this
> (unix) manner?  I'm never going to be loading any unix-created files on my
> system, and just want them loaded just the same as if I had loaded in
> notepad.

Modify the variable `file-coding-system-alist' to use the -dos variants,
rather than the generic (autodetecting) variants of the coding systems.

Regards,
        Daniel
-- 
The aim of psychoanalysis is to relieve people of their neurotic unhappiness
so that they can be normally unhappy.
        -- Sigmund Freud





reply via email to

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