Org-mode mailing list
 help / color / mirror / Atom feed
From: "Sébastien Miquel" <sebastien.miquel@posteo.eu>
To: mail@nicolasgoaziou.fr
Cc: bzg@gnu.org, emacs-orgmode@gnu.org, sebastian.miele@gmail.com
Subject: Re: [PATCH] Bug: Fontification: Heading following a comment
Date: Wed, 16 Sep 2020 08:30:36 +0200
Message-ID: <d9752975-0022-babf-afa3-28a0207ede3f@posteo.eu> (raw)
In-Reply-To: <87d02n2qkm.fsf@nicolasgoaziou.fr>

[-- Attachment #1: Type: text/plain, Size: 853 bytes --]

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 <sebastien.miquel91@orange.fr> 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,
>

[-- Attachment #2: 0001-org.el-org-fontify-meta-lines-and-blocks-1-Fix-meta-.patch --]
[-- Type: text/x-patch, Size: 2206 bytes --]

From 2bb847473f2199e1dfd03ddcafdd3563ed46ab78 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?S=C3=A9bastien=20Miquel?= <sebastien.miquel@posteo.eu>
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

  reply	other threads:[~2020-09-16  6:32 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-03-20 11:59 Sebastian Miele
2020-09-04  8:44 ` Bastien
2020-09-15  6:26   ` [PATCH] " Sebastien Miquel
2020-09-15 12:05     ` Nicolas Goaziou
2020-09-16  6:30       ` Sébastien Miquel [this message]
2020-09-16 19:44         ` Nicolas Goaziou
2020-09-23  8:02     ` Bastien

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://orgmode.org

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=d9752975-0022-babf-afa3-28a0207ede3f@posteo.eu \
    --to=sebastien.miquel@posteo.eu \
    --cc=bzg@gnu.org \
    --cc=emacs-orgmode@gnu.org \
    --cc=mail@nicolasgoaziou.fr \
    --cc=sebastian.miele@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

Org-mode mailing list

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://orgmode.org/list/0 list/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 list list/ https://orgmode.org/list \
		emacs-orgmode@gnu.org
	public-inbox-index list

Example config snippet for mirrors.
Newsgroups are available over NNTP:
	nntp://news.yhetil.org/yhetil.emacs.orgmode
	nntp://news.gmane.io/gmane.emacs.orgmode


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git