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: Tue, 27 Jun 2017 08:05:05 +0200 Message-ID: <8460fi7ypa.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 1498543641 24598 195.159.176.226 (27 Jun 2017 06:07:21 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Tue, 27 Jun 2017 06:07:21 +0000 (UTC) Cc: Vincent =?UTF-8?Q?Bela=C3=AFche?= To: Philipp Stephani , 27391@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Tue Jun 27 08:07:15 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 1dPjeb-0005va-6m for geb-bug-gnu-emacs@m.gmane.org; Tue, 27 Jun 2017 08:07:13 +0200 Original-Received: from localhost ([::1]:50789 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dPjee-00069a-NM for geb-bug-gnu-emacs@m.gmane.org; Tue, 27 Jun 2017 02:07:16 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:41400) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dPjdY-0005e5-3N for bug-gnu-emacs@gnu.org; Tue, 27 Jun 2017 02:06:09 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dPjdT-0001L6-4H for bug-gnu-emacs@gnu.org; Tue, 27 Jun 2017 02:06:08 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:37190) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1dPjdT-0001Kl-0I for bug-gnu-emacs@gnu.org; Tue, 27 Jun 2017 02:06:03 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1dPjdS-00004z-Iy for bug-gnu-emacs@gnu.org; Tue, 27 Jun 2017 02:06:02 -0400 X-Loop: help-debbugs@gnu.org 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: Tue, 27 Jun 2017 06:06:02 +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.149854351732712 (code B ref 27391); Tue, 27 Jun 2017 06:06:02 +0000 Original-Received: (at 27391) by debbugs.gnu.org; 27 Jun 2017 06:05:17 +0000 Original-Received: from localhost ([127.0.0.1]:39867 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dPjcj-0008VX-BA for submit@debbugs.gnu.org; Tue, 27 Jun 2017 02:05:17 -0400 Original-Received: from smtp03.smtpout.orange.fr ([80.12.242.125]:31066 helo=smtp.smtpout.orange.fr) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dPjch-0008VG-C3 for 27391@debbugs.gnu.org; Tue, 27 Jun 2017 02:05:15 -0400 Original-Received: from AigleRoyal ([86.214.235.176]) by mwinf5d57 with ME id di511v00M3p1sk603i51y7; Tue, 27 Jun 2017 08:05:09 +0200 X-ME-Helo: AigleRoyal X-ME-Auth: dmluY2VudGJlbGFpY2hlQG9yYW5nZS5mcg== X-ME-Date: Tue, 27 Jun 2017 08:05:09 +0200 X-ME-IP: 86.214.235.176 In-Reply-To: X-Antivirus: Avast (VPS 170626-4, 26/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:133943 Archived-At: My answers inserted below. Le 26/06/2017 =E0 13:39, Philipp Stephani a =E9crit : > > > Vincent Bela=EFche schrieb am Mo., 19. Juni = 2017 um 12:51 Uhr: > > > Concerning factorization, couldn't one use [\n\r] in all cases > rather than a switch based on some input argument ? > > > It should be possible, but it slightly changes the behavior of > file-local variables. I wouldn't expect anything to break though. > > Sorry, I can't understand why there should be any slight change in the current behaviour. BTW, as in the doit function given below what I had in mind was some "\\(\r\n?\\|\n\\)" construct rather than a plain "[\r\n]", so it consistently matches CR (as one some Apple computers), CR-LF (as on MSW) and LF. > > I was also wondering whether it is not possible to have a single rege= xp > for the whole Local Variable section. The following `doit' function i= s a > trial to do so. `M-x doit' will seach forward the whole Local Variabl= es > section and display "ok" if found, "nak" otherwise. > > (defun doit () > (interactive) > (let* ((eol "\\(\r\n?\\|\n\\)") > (eol-again "\\1") > (space-maybe "[ \t]*") > ;; suffix may be the empty string > (suffix "\\([^ \r\n]+\\(?:[^\r\n]*[^ \r\n]\\)?\\|\\)") > (prefix "\\([ \t]*[^ \r\n]+\\(?:[^\r\n]*[^ \r\n]\\)?\\)") > (prefix-again "\\2") > (suffix-again "\\3") > (symbol: "\\(?:\\(?:[^][()'\" \t\r\n]\\|\\\\[][()'\" \t]\\)+= [ \t]*:\\)") > (sexp (concat "\\(?:" (substring prefix 2)))) > > (message (if (and (re-search-forward > (concat eol > prefix space-maybe "Local Variables:" space= -maybe suffix space-maybe eol-again > "\\(?:" prefix space-maybe symbol: sexp sp= ace-maybe suffix-again space-maybe eol-again "\\)*" > prefix space-maybe "End:" space-maybe suffi= x space-maybe "\\(" eol-again "\\)?" > ) > nil t) > ;; when the tailing eol is not there we must be at = EOB. > (or (match-string 3) (eobp))) > "ok" "nak")))) > > > > Looks good. Consider using `rx' for complex regexes, in my experiences it= increases readability a lot. On second thought the regexp considered above has some limitation : it would fail if the sexp is multiline. For instance the following would fail. --8<----8<----8<----8<----8<-- begin -->8---->8---->8---->8---->8---- /* Local Variables: */ /* multiline-sexp: ( "first line" "second line" ) */ /* End: */ --8<----8<----8<----8<----8<-- end -->8---->8---->8---->8---->8---- This is a regression as I think that the current code allows multiline --- well I am not 100% sure of that, I presume this just from my reading the current code. I don't know if multiline sexps in file local variables is a desirable feature, personally I have never used them. And I am not even sure either that making a regexp that matches an Elisp sexp is feasible, or sensible. It is not sensible in my opinion because any change in the Elisp reader --- like supporting bignums as we had discussed quite some day ago with Jay Belanger, maintainer of Calc --- would imply some change in this regexp. And regpexps do not support either any [:elisp-sexp:] construct that would do the job with some `read' call under the hood. 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