From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: vincent.belaiche@gmail.com (Vincent =?UTF-8?Q?Bela=C3=AFche?=) Newsgroups: gmane.emacs.bugs Subject: bug#27391: 25.2.50; utf-8 coding cookie is not applied on some specific markdown file Date: Fri, 16 Jun 2017 23:27:27 +0200 Message-ID: <84zid7y668.fsf@gmail.com> References: <841sqkdzh5.fsf@gmail.com> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable X-Trace: blaine.gmane.org 1497648493 11408 195.159.176.226 (16 Jun 2017 21:28:13 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Fri, 16 Jun 2017 21:28:13 +0000 (UTC) Cc: Vincent =?UTF-8?Q?Bela=C3=AFche?= To: Eli Zaretskii , 27391@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Fri Jun 16 23:28:09 2017 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dLymm-0002dI-FX for geb-bug-gnu-emacs@m.gmane.org; Fri, 16 Jun 2017 23:28:08 +0200 Original-Received: from localhost ([::1]:60776 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dLymr-0001da-4y for geb-bug-gnu-emacs@m.gmane.org; Fri, 16 Jun 2017 17:28:13 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:53353) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dLymk-0001dK-Hi for bug-gnu-emacs@gnu.org; Fri, 16 Jun 2017 17:28:07 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dLymg-0007CB-Hm for bug-gnu-emacs@gnu.org; Fri, 16 Jun 2017 17:28:06 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:49076) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1dLymg-0007Bs-E6 for bug-gnu-emacs@gnu.org; Fri, 16 Jun 2017 17:28:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1dLymf-000640-VE for bug-gnu-emacs@gnu.org; Fri, 16 Jun 2017 17:28:01 -0400 X-Loop: help-debbugs@gnu.org In-Reply-To: <841sqkdzh5.fsf@gmail.com> Resent-From: vincent.belaiche@gmail.com (Vincent =?UTF-8?Q?Bela=C3=AFche?=) Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 16 Jun 2017 21:28:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 27391 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 27391-submit@debbugs.gnu.org id=B27391.149764845923265 (code B ref 27391); Fri, 16 Jun 2017 21:28:01 +0000 Original-Received: (at 27391) by debbugs.gnu.org; 16 Jun 2017 21:27:39 +0000 Original-Received: from localhost ([127.0.0.1]:51753 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dLymJ-00063B-BF for submit@debbugs.gnu.org; Fri, 16 Jun 2017 17:27:39 -0400 Original-Received: from smtp05.smtpout.orange.fr ([80.12.242.127]:31628 helo=smtp.smtpout.orange.fr) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dLymH-00062v-UY for 27391@debbugs.gnu.org; Fri, 16 Jun 2017 17:27:38 -0400 Original-Received: from AIGLEROYAL ([90.32.171.63]) by mwinf5d40 with ME id ZZTW1v00L1NRGYS03ZTWjG; Fri, 16 Jun 2017 23:27:31 +0200 X-ME-Helo: AIGLEROYAL X-ME-Auth: dmluY2VudGJlbGFpY2hlQG9yYW5nZS5mcg== X-ME-Date: Fri, 16 Jun 2017 23:27:31 +0200 X-ME-IP: 90.32.171.63 X-Antivirus: Avast (VPS 170616-2, 16/06/2017), Outbound message X-Antivirus-Status: Clean X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 208.118.235.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:133669 Archived-At: Le 16/06/2017 =E0 21:37, Vincent Bela=EFche a =E9crit : > > > Le 16/06/2017 =E0 21:15, Vincent Bela=EFche a =E9crit : >> [...] >> >> > 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 into. = 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 () (interactive) (let* ((prefix (regexp-quote "[comment]: # (")) (suffix (regexp-quote ")")) (re-coding (concat "[\r\n]" prefix ;; N.B. without the \n below, the regexp can ;; eat newlines. "[ \t]*coding[ \t]*:[ \t]*\\([^ \t\r\n]+\\)[ \t]*" suffix "[\r\n]"))) (message (if (looking-at re-coding) "ok" "nak")))) I tried it with point at end of line [comment]: # ( Local Variables: ) and it answered "ok". Now I defined this with re-search-forward instead of looking-at: (defun doit () (interactive) (let* ((prefix (regexp-quote "[comment]: # (")) (suffix (regexp-quote ")")) (re-coding (concat "[\r\n]" prefix ;; N.B. without the \n below, the regexp can ;; eat newlines. "[ \t]*coding[ \t]*:[ \t]*\\([^ \t\r\n]+\\)[ \t]*" suffix "[\r\n]"))) (message (if (re-search-forward re-coding nil t) "ok" "nak")))) I placed the point before the coding: line, and I also got answer "ok" 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... Vincent. --- L'absence de virus dans ce courrier =E9lectronique a =E9t=E9 v=E9rifi=E9e p= ar le logiciel antivirus Avast. https://www.avast.com/antivirus