From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Philipp Stephani Newsgroups: gmane.emacs.bugs Subject: bug#27391: 25.2.50; utf-8 coding cookie is not applied on some specific markdown file Date: Mon, 26 Jun 2017 11:39:12 +0000 Message-ID: References: <84lgooxnbe.fsf@gmail.com> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="001a113d2bde09b1490552db67e6" X-Trace: blaine.gmane.org 1498477218 22526 195.159.176.226 (26 Jun 2017 11:40:18 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Mon, 26 Jun 2017 11:40:18 +0000 (UTC) To: Vincent =?UTF-8?Q?Bela=C3=AFche?= , 27391@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Mon Jun 26 13:40:12 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 1dPSNE-0005L0-B0 for geb-bug-gnu-emacs@m.gmane.org; Mon, 26 Jun 2017 13:40:08 +0200 Original-Received: from localhost ([::1]:46005 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dPSNI-0005pd-CT for geb-bug-gnu-emacs@m.gmane.org; Mon, 26 Jun 2017 07:40:12 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:57558) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dPSNC-0005or-VA for bug-gnu-emacs@gnu.org; Mon, 26 Jun 2017 07:40:08 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dPSN8-0007Fq-Ud for bug-gnu-emacs@gnu.org; Mon, 26 Jun 2017 07:40:07 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:35432) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1dPSN8-0007Fm-RV for bug-gnu-emacs@gnu.org; Mon, 26 Jun 2017 07:40:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1dPSN8-00020a-HX for bug-gnu-emacs@gnu.org; Mon, 26 Jun 2017 07:40:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Philipp Stephani Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 26 Jun 2017 11:40: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.14984771717676 (code B ref 27391); Mon, 26 Jun 2017 11:40:02 +0000 Original-Received: (at 27391) by debbugs.gnu.org; 26 Jun 2017 11:39:31 +0000 Original-Received: from localhost ([127.0.0.1]:38109 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dPSMc-0001zk-L4 for submit@debbugs.gnu.org; Mon, 26 Jun 2017 07:39:30 -0400 Original-Received: from mail-oi0-f54.google.com ([209.85.218.54]:35487) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dPSMb-0001zW-Dl for 27391@debbugs.gnu.org; Mon, 26 Jun 2017 07:39:29 -0400 Original-Received: by mail-oi0-f54.google.com with SMTP id c189so52753936oia.2 for <27391@debbugs.gnu.org>; Mon, 26 Jun 2017 04:39:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=z86JN2rVkqfvOk6DirNmb9+8mSS1Qosu2BUQg3js4Ik=; b=kMhpaHqCIHGytfx+fD36ri7pwe2kAzH4stL2o07Od019jv7KxjZ9/h0lzJkJ565cM2 qy6cnyksEEthYWieawB5E2+juMTr2/4iC3WIRjCyQspQVtqR93MRBfMEDJBXkklsXjNT q5NC04mQZ4eACaQYmUR3DsBLirnMDNBjY5aUdHKqzkhuDbLYvj2RnskM9YHLwUh+2FrY 0+w55RS/AqwbVokcVU1jzQmx1GH7tLPks9EGyMJINMZdUewbGsYSB1g/TUBoeCua8YMb 4T97AsAU0btWEw2XAOROFXCa9OzTSJsKr70zkP7AM0tLlQorY4ub50cObbbbvWhqJsu5 RICg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=z86JN2rVkqfvOk6DirNmb9+8mSS1Qosu2BUQg3js4Ik=; b=gReI+VHArELXSFRatystD2GHcNHX27oC9mVSeKSd1VhUfF8S1HmUjElnH8cRcNLcGo 44J9t1wiZ9hJe5nqwElzLdSCopr7idxDHeQIYevwN1dmUE5DS5a/jgGiKuc8wS6iljil VdA8UMadqG68D23PnbwrQy6hnsIjwhWJ2ORMsWUembyPMaRzz/gh0S8iCMoxVC1OWZRR 7AU4ResVRk2birsvpEUhWPVHhE2NMh7fWQ69dL2gniXMd/aiMWpjtx8ofRhjMDuVZ63E wYZbK/Uz1WZWwQsnJIW6usoUSTazsAfS4zUpnWhiCDs1p8/feVZfCu4d54/z/O6Gp6Yf SsPw== X-Gm-Message-State: AKS2vOyg6e5QU4FogOG4cPcJheB3agPKsf6AFN+GQouGu/h9Sr7jbN0k ZaOqZXg1FTmO0BLnIVlgro+LhzNmfA== X-Received: by 10.202.98.197 with SMTP id w188mr5085880oib.191.1498477163555; Mon, 26 Jun 2017 04:39:23 -0700 (PDT) In-Reply-To: <84lgooxnbe.fsf@gmail.com> 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:133919 Archived-At: --001a113d2bde09b1490552db67e6 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Vincent Bela=C3=AFche 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. > > I was also wondering whether it is not possible to have a single regexp > for the whole Local Variable section. The following `doit' function is a > trial to do so. `M-x doit' will seach forward the whole Local Variables > 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 > space-maybe suffix-again space-maybe eol-again "\\)*" > prefix space-maybe "End:" space-maybe suffix > 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. --001a113d2bde09b1490552db67e6 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable


Vincen= t Bela=C3=AFche <vincent.b= elaiche@gmail.com> schrieb am Mo., 19. Juni 2017 um 12:51=C2=A0Uhr:<= br>

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-l= ocal variables. I wouldn't expect anything to break though.=C2=A0
=
=C2=A0

I was also wondering whether it is not possible to have a single regexp
for the whole Local Variable section. The following `doit' function is = a
trial to do so. `M-x doit' will seach forward the whole Local Variables=
section and display "ok" if found, "nak" otherwise.

(defun doit ()
=C2=A0 (interactive)
=C2=A0 (let* ((eol "\\(\r\n?\\|\n\\)")
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(eol-again "\\1")
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(space-maybe "[ \t]*")
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0;; suffix may be the empty string
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(suffix=C2=A0 "\\([^ \r\n]+\\(?:[^\r= \n]*[^ \r\n]\\)?\\|\\)")
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(prefix "\\([ \t]*[^ \r\n]+\\(?:[^\r= \n]*[^ \r\n]\\)?\\)")
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(prefix-again "\\2")
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(suffix-again "\\3")
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(symbol: "\\(?:\\(?:[^][()'\&quo= t; \t\r\n]\\|\\\\[][()'\" \t]\\)+[ \t]*:\\)")
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(sexp (concat "\\(?:" (substrin= g prefix 2))))

=C2=A0 =C2=A0 (message (if (and (re-search-forward
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (concat eol<= br> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 prefix space-maybe "Local Variables:" space-may= be suffix space-maybe eol-again
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 "\\(?:" prefix space-maybe symbol:=C2=A0 sexp s= pace-maybe suffix-again space-maybe eol-again "\\)*"
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 prefix space-maybe "End:" space-maybe suffix sp= ace-maybe "\\(" eol-again "\\)?"
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 )
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 nil t)
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 ;; when the = tailing eol is not there we must be at EOB.
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (or (match-s= tring 3) (eobp)))
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 "ok" "n= ak"))))



Looks good. Consider using `rx' fo= r complex regexes, in my experiences it increases readability a lot.=C2=A0<= /div>
--001a113d2bde09b1490552db67e6--