"Ilya N. Golubev" <gin(a)mo.msk.ru> writes:
`insert-file-contents-internal' is expected to use its
`codesys'
arg. This argument is normally created when `insert-file-contents'
tries various ways of determining file coding system, including
`insert-file-contents-pre-hook' call.
`insert-file-contents-internal' may call filename hanlders obtained
by `Ffind_file_name_handler (filename, Qinsert_file_contents)' call.
Such handlers are established by remote file access packages like
efs. In this case the `handler' call replaces most of processing
normally done by `insert-file-contents-internal' itself, including
that of `codesys'.
But this argument is never passed to `handler' and thus discarded.
Could we fix this by having `insert-file-contents-internal' bind
`coding-system-for-read' to the value of CODESYS if non-nil CODESYS
was provided? This should force the use of the correct coding system
in called functions.
Handler may even call `insert-file-contents' recursively, which
in
turn will trigger file coding determining again, with
`insert-file-contents-pre-hook' call. So many unnecessary
`insert-file-contents-pre-hook' calls may be done on the same file.
There may be 2 of them if both efs and dired are loaded.
This complicates `insert-file-contents-pre-hook' functions which do
some expensive processing. [...]
I don't understand how this is connected to the problem of dropping
CODESYS you described above. Or are you describing two different
problems?