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

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

Re: How does one disable (UTF-8?) input "fixup"?


From: Winston
Subject: Re: How does one disable (UTF-8?) input "fixup"?
Date: Tue, 12 Jan 2016 02:51:30 -0500
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.5 (berkeley-unix)

I originally asked:
>> What mode/variable controls text conversion/fixup when reading a file?

>> I have a mostly ASCII text file that contains a few stray non-ASCII
>> characters.

Eli Zaretskii <eliz@gnu.org> kindly replied:
> You need to prefix "C-x C-f" with "C-x RET c us-ascii RET".  See the
> node "Text Coding" in the Emacs manual.

> Or use "M-x find-file-literally" to disable any conversions.

Ah.  OK.  Thanks!

>> However, if I rename the file "foo.exe", do "emacs foo.exe" and
>> search, I see the original characters (no change).

> Emacs by default visits binary files without any conversions.

...which is what I expected and had been used to, and why I tried
renaming the file "foo.exe" as a work-around to prevent the conversions.
:-)

>> Curiously, after "emacs foo.exe", I did find-file-other-window to
>> read in "foo", and the characters were NOT altered.

> Because the file is already in an Emacs buffer, so Emacs doesn't
> re-read it, it just reuses that buffer's contents.

You appear to be referring to this feature of find-file-literally:

    "You cannot absolutely rely on this function to result in
     visiting the file literally.  If Emacs already has a buffer
     which is visiting the file, you get the existing buffer,
     regardless of whether it was created literally or not."

However, that wasn't the case I described.  I had identical content in
two separate disk files ("foo" and "foo.exe").  The files were not
linked (hard or symbolic).  [Think "bar" instead of "foo" if that
helps.]  I started emacs with "emacs foo.exe".  "foo" was not in any
Emacs buffer at that point.  I then used find-file-other-window to read
"foo".  That created a second buffer to hold "foo".  Although the
contents happened to be identical, from Emacs's standpoint, they were
two separate files in two separate buffers.  I was surprised that
character conversions upon reading "foo" as the second file into a
second buffer were in any way affected by having read some other file
into another buffer before it.

No matter...  You answered my question about how to prevent the
conversions without having to rename the file.  Thanks!
 -WBE


reply via email to

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