Hi Werner,

Werner LEMBERG <[email protected]> writes:

> Consider the two attached files, `ä.tex` and `ä-include.tex`.  If I
> load `ä-include.tex`, AUCTeX also tries to load master file `ä.tex`.
> However, this fails: the file name isn't correctly encoded or decoded
> and a buffer called `\303\244.tex` gets created instead (see attached
> image).
>
>
>     Werner
>
> \documentclass{article}
>
> \begin{document}
>
> master-foo
>
> \include{ä-include}
>
> master-bar
>
> \end{document}
>
> %%% Local Variables:
> %%% coding: utf-8
> %%% mode: latex
> %%% TeX-engine: luatex
> %%% TeX-master: t
> %%% End:
>
> include-foo
>
> %%% Local Variables:
> %%% mode: latex
> %%% TeX-engine: luatex
> %%% TeX-master: "ä"
> %%% End:

I think this is more an Emacs issue.  Try the following with your files
above (i.e., without %%% coding: uft-8 in Local Variables of
ä-include.tex):

• Start Emacs
• In scratch, eval:
    (progn (load-library "latexenc") (find-library "latexenc"))
• Instrument the function `latexenc-find-file-coding-system'
• Open your ä-include.tex
• Watch for the return value of this part:
    (let ((file (if (re-search-forward
                   "^%+ *\\(TeX-master\\|tex-main-file\\): *\"\\(.+\\)\""
                   nil t)
                  (match-string 2)

I see \303\244.tex.  So I think `latexenc-find-file-coding-system'
returns the wrong value since Emacs hasn't set its coding for read
properly when that function kicks in.  I admit I'm not knowledgeable in
this area, so my pretty simple recommendation is to customize the
variable `file-coding-system-alist' and do something like this:

  (add-to-list 'file-coding-system-alist
               '("\\.\\(tex\\|ltx\\|dtx\\|drv\\)\\'" . prefer-utf-8))

HTH.  Best, Arash



_______________________________________________
bug-auctex mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/bug-auctex

Reply via email to