From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp0 ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms11 with LMTPS id KEkLC3axYV/7NAAA0tVLHw (envelope-from ) for ; Wed, 16 Sep 2020 06:32:22 +0000 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp0 with LMTPS id gKJ4BXaxYV+KJQAA1q6Kng (envelope-from ) for ; Wed, 16 Sep 2020 06:32:22 +0000 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 9D192940653 for ; Wed, 16 Sep 2020 06:32:21 +0000 (UTC) Received: from localhost ([::1]:58588 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kIQzL-00051E-Sl for larch@yhetil.org; Wed, 16 Sep 2020 02:32:19 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:34406) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kIQxs-00050B-BJ for emacs-orgmode@gnu.org; Wed, 16 Sep 2020 02:30:48 -0400 Received: from mout02.posteo.de ([185.67.36.66]:56597) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kIQxo-0007qG-Li for emacs-orgmode@gnu.org; Wed, 16 Sep 2020 02:30:47 -0400 Received: from submission (posteo.de [89.146.220.130]) by mout02.posteo.de (Postfix) with ESMTPS id B1CE32400FC for ; Wed, 16 Sep 2020 08:30:39 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.eu; s=2017; t=1600237839; bh=XaFAIaGoxtFQDg1dxBF1AhJU460Ja4cTM60A+adkkzE=; h=Subject:To:Cc:From:Date:From; b=e1+pt+QRHHobfL+ZJ3m2VzulE7N5pEF4ZpFL0G+xtHy+sVAX8s6Yr4kOsquh9KUm8 wFEeXkqegaR+9tt9WgN5ZHLcLtiS7n8N2CIoE1s0CW1+pt51ALzhYxMBTRd5kFwbex +wKvbMTzlDfAZNBvy95AECHsesgNklbLAEa3br5dKDnn5aexfTRSNJZx2n7Y03WYso RqjyI4mI961f1SRH30sF9xMW//U3eF8djsVpe6SwoYpAh0gNyqH+qY2p82lMIJ3dXn 5cKwMZ/Bslu7YQapKCQ5k0AnfEKmJU42fzo0Wy7r1T2hyorWI3tRovSIORCzziqoPl n1IpMn+E+ShPg== Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4BrqwZ0WDnz6tmD; Wed, 16 Sep 2020 08:30:37 +0200 (CEST) Subject: Re: [PATCH] Bug: Fontification: Heading following a comment To: mail@nicolasgoaziou.fr References: <87y2lqq6ck.fsf@gnu.org> <8014fc55-b761-2158-f4f8-125603bc6fd7@orange.fr> <87d02n2qkm.fsf@nicolasgoaziou.fr> From: =?UTF-8?Q?S=c3=a9bastien_Miquel?= Message-ID: Date: Wed, 16 Sep 2020 08:30:36 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.12.0 MIME-Version: 1.0 In-Reply-To: <87d02n2qkm.fsf@nicolasgoaziou.fr> Content-Type: multipart/mixed; boundary="------------10D4C92FC23F6CA17F624E1E" Content-Language: fr Received-SPF: pass client-ip=185.67.36.66; envelope-from=sebastien.miquel@posteo.eu; helo=mout02.posteo.de X-detected-operating-system: by eggs.gnu.org: First seen = 2020/09/16 02:30:40 X-ACL-Warn: Detected OS = Linux 3.11 and newer [fuzzy] X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, NICE_REPLY_A=-0.001, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-orgmode@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: sebastien.miquel@posteo.eu Cc: bzg@gnu.org, emacs-orgmode@gnu.org, sebastian.miele@gmail.com Errors-To: emacs-orgmode-bounces+larch=yhetil.org@gnu.org Sender: "Emacs-orgmode" X-Scanner: scn0 Authentication-Results: aspmx1.migadu.com; dkim=fail (rsa verify failed) header.d=posteo.eu header.s=2017 header.b=e1+pt+QR; dmarc=fail reason="SPF not aligned (strict)" header.from=posteo.eu (policy=none); spf=pass (aspmx1.migadu.com: domain of emacs-orgmode-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=emacs-orgmode-bounces@gnu.org X-Spam-Score: 0.09 X-TUID: BNJdmFSgMTGu This is a multi-part message in MIME format. --------------10D4C92FC23F6CA17F624E1E Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Hi, Thanks for taking a look. Afaict, the only difference between blank and [ \t] are some weird unicode characters. It isn't clear to me which one should be preferable and in what situation. I couldn't find any reference to this in any documentation of Org syntax. I've replaced all instances of blank with (any " \t") in this function (that's the only instances in org.el). The attached patch fixes the original issue. Regards, Sébastien Miquel Nicolas Goaziou wrote: > Hello, > > Sebastien Miquel writes: > >> (rx bol (group (zero-or-more blank) "#" >> (group (group (or (seq "+" (one-or-more (any "a-zA-Z")) (optional ":")) >> - space >> + blank > This looks wrong, but so does the current regexp. It should not be > `space' nor `blank', but [ \t] per Org syntax. > > Regards, > --------------10D4C92FC23F6CA17F624E1E Content-Type: text/x-patch; charset=UTF-8; name="0001-org.el-org-fontify-meta-lines-and-blocks-1-Fix-meta-.patch" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename*0="0001-org.el-org-fontify-meta-lines-and-blocks-1-Fix-meta-.pa"; filename*1="tch" >From 2bb847473f2199e1dfd03ddcafdd3563ed46ab78 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Miquel?= Date: Wed, 16 Sep 2020 07:49:34 +0200 Subject: [PATCH] org.el (org-fontify-meta-lines-and-blocks-1): Fix meta lines regexp * lisp/org.el (org-fontify-meta-lines-and-blocks-1): Fix meta lines regexp to work correctly for lines with only a #. Replace blank in regexp by (any " \t"). TINYCHANGE --- lisp/org.el | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/lisp/org.el b/lisp/org.el index d09d6c8d2..053635c85 100644 --- a/lisp/org.el +++ b/lisp/org.el @@ -5219,14 +5219,14 @@ by a #." "Fontify #+ lines and blocks." (let ((case-fold-search t)) (when (re-search-forward - (rx bol (group (zero-or-more blank) "#" + (rx bol (group (zero-or-more (any " \t")) "#" (group (group (or (seq "+" (one-or-more (any "a-zA-Z")) (optional ":")) - space + (any " \t") eol)) (optional (group "_" (group (one-or-more (any "a-zA-Z")))))) - (zero-or-more blank) + (zero-or-more (any " \t")) (group (group (zero-or-more (not (any " \t\n")))) - (zero-or-more blank) + (zero-or-more (any " \t")) (group (zero-or-more any))))) limit t) (let ((beg (match-beginning 0)) @@ -5249,7 +5249,7 @@ by a #." quoting (member block-type org-protecting-blocks)) (when (re-search-forward (rx-to-string `(group bol (or (seq (one-or-more "*") space) - (seq (zero-or-more blank) + (seq (zero-or-more (any " \t")) "#+end" ,(match-string 4) word-end @@ -5323,11 +5323,11 @@ by a #." ;; Handle short captions (save-excursion (beginning-of-line) - (looking-at (rx (group (zero-or-more blank) + (looking-at (rx (group (zero-or-more (any " \t")) "#+caption" (optional "[" (zero-or-more any) "]") ":") - (zero-or-more blank)))) + (zero-or-more (any " \t"))))) (add-text-properties (line-beginning-position) (match-end 1) '(font-lock-fontified t face org-meta-line)) (add-text-properties (match-end 0) (line-end-position) -- 2.28.0 --------------10D4C92FC23F6CA17F624E1E--