On 17 Apr 2002, Stephen J. Turnbull spake:
It may be an accessory before the fact though. I ran into a problem
in latin-unity.el, which hangs a function on write-region-pre-hook,
where the hook gets called once, then dired's (yep) handler gets
called from write-region-internal, which calls the hook again. And
(like here) for some reason the standard "i'm-already-in-a-handler"
flag didn't do the right thing.
The reason is this. I'll delineate the control flow in the case that's
breaking me more carefully.
make_string_from_file() or something else calls
Finsert_file_contents_internal(), passing a nil `codesys'. (Note,
however, that all the coding-system variables may have different values,
and have not been rebound.)
This then finds an active handler matching this file and calls it,
passing it Qinsert_file_contents.
That handler then eventually does the work by funcalling that operation
--- which, because the coding-system variables haven't been rebound,
proceeds to insert the file with a coding-system other than nil.
(This all applies with any other explicit coding-system too; if you pass
*any* coding system to Finsert_file_contents_internal() and don't bind
the coding-system-for-read to the same value, you're asking for
problems. I have a feeling that perhaps Finsert_file_contents_internal
should do the binding itself.)
The Lisp `insert-file-contents-literally' binds the
file-name-handler-alist to nil explicitly, so ISTM that someone's seen
this before but didn't think of all the C-side code that could be doing
things wrong, too :(
I don't _know_, but there's a
certain
odor wafting from that general direction.... So if you can say "I
want binary and THAT IS THAT" you should bind `coding-system-for-read'
to binary. If you're already doing that,
How can I? This is glyph-instantiation code: I have no (direct) control
over when it's called! --- well, in practice I know it'll always be
called when I call `make-glyph', but I feel it's decidedly unwise to
rely upon that.
(Of course, I've replaced that code with code that sets the :data and
does an explicit `insert-file-contents-literally', and *that* works.)
--
`Unless they've moved it since I last checked, travelling between
England and America does not involve crossing the equator.'
--- pir