preview-latex has triggered another fun bug.
The glyph-reading code (in the person of
glyphs.c:make_string_from_file()) takes great care to avoid having
file-coding conversions apply to the glyphs it reads, to the extent of
locally binding `format-alist' to nil.
Unfortunately, dired torpedoes it. While you're displaying a directory
with dired, there is in the global value of your file-name-handler-alist
the element
("." . dired-handler-fn)
(note that the first element is a regexp!)
Now make_string_from_file calls Finsert_file_contents_literally(); this
proceeds to check for a file-name-handler and trigger it, passing it the
insert-file-contents symbol.
That dired function then calls that to do the reading --- which *uses
coding systems* and may well proceed to assume that your PNG file is a
DOS file, reading it in and fubaring it completely.
So it looks like either dired has to be fixed to not be so bloody
stupid, or (preferably, and more generically) the right handlers should
be called: i.e., if the coding-system is nil,
Qinsert_file_contents_literally should be passed to the
file-name-handler-alist --- if you're allowed to add random things to
the list of file-name-handler-alist operations, which I kind of doubt.
--
`Unless they've moved it since I last checked, travelling between
England and America does not involve crossing the equator.'
--- pir