From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Philipp Stephani
Le 16/06/2017 =C3=A0 21:37, Vincent Bela=C3=AFche a =C3=A9crit :
>
>
> Le 16/06/2017 =C3=A0 21:15, Vincent Bela=C3=AFche a =C3=A9crit :
>>
[...]
>>
>>
> After some more investigation, I think that the bug is in function
> insert-file-contents of fileio.c which is the one that decide and sets=
> the coding system well before the other local variables are looked int= o.
After some more investigation, in the end the find-auto-coding of
mule.el is what is called to detect the coding. This function calls some
re-coding regexp.
Here is a test function defining the same regexp.
(defun doit ()
=C2=A0 (interactive)
=C2=A0 (let* ((prefix (regexp-quote "[comment]: # ("))
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(suffix (regexp-quote ")"))
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(re-coding
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (concat
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0"[\r\n]" prefix
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0;; N.B. without the \n below, the = regexp can
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0;; eat newlines.
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0"[ \t]*coding[ \t]*:[ \t]*\\(= [^ \t\r\n]+\\)[ \t]*"
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0suffix "[\r\n]")))
=C2=A0 =C2=A0 (message (if (looking-at re-coding) "ok" "nak&= quot;))))
I tried it with point at end of line
[comment]: # ( Local Variables: )
and it answered "ok". Now I defined this with re-search-forward i= nstead
of looking-at:
(defun doit ()
=C2=A0 (interactive)
=C2=A0 (let* ((prefix (regexp-quote "[comment]: # ("))
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(suffix (regexp-quote ")"))
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(re-coding
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (concat
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0"[\r\n]" prefix
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0;; N.B. without the \n below, the = regexp can
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0;; eat newlines.
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0"[ \t]*coding[ \t]*:[ \t]*\\(= [^ \t\r\n]+\\)[ \t]*"
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0suffix "[\r\n]")))
=C2=A0 =C2=A0 (message (if (re-search-forward re-coding nil t) "ok&quo= t; "nak"))))
I placed the point before the coding: line, and I also got answer "ok&= quot;
So I don't think that the regexp as such is to blame. Something else
seems to happen. It is too late now, I need to go to bed...
=C2=A0 Vincent.