From mboxrd@z Thu Jan 1 00:00:00 1970 From: Nicolas Goaziou Subject: Re: Org emphasis markers inside src blocks causes incorrect fontification Date: Sat, 18 Nov 2017 00:30:02 +0100 Message-ID: <87h8tstret.fsf@nicolasgoaziou.fr> References: <87bmk1vqtt.fsf@nicolasgoaziou.fr> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:57324) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eFq5J-0004Pw-SC for emacs-orgmode@gnu.org; Fri, 17 Nov 2017 18:30:10 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eFq5G-0007u0-LW for emacs-orgmode@gnu.org; Fri, 17 Nov 2017 18:30:09 -0500 Received: from relay4-d.mail.gandi.net ([217.70.183.196]:36064) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1eFq5G-0007tZ-ED for emacs-orgmode@gnu.org; Fri, 17 Nov 2017 18:30:06 -0500 In-Reply-To: (Kaushal Modi's message of "Thu, 16 Nov 2017 21:56:56 +0000") List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: "Emacs-orgmode" To: Kaushal Modi Cc: emacs-org list --=-=-= Content-Type: text/plain Hello, Kaushal Modi writes: > Again it's a font-locking bug, and thankfully doesn't impact the empasis > detection in exporters. > > Would you please look into fixing this? I cannot. Fixing it would require to rewrite the whole thing to use the parser, so that fontification matches the syntax of the document. This, in turn, would require to repair the parser's cache so that it doesn't freeze when the wind is north, northwest. Ah, well. Meanwhile, I pile up ad-hoc rules to avoid mis-fontification, until the next pathological case is reported. IOW, I'm only mildly interested in fixing fontification bugs. You may want to test the following rules and report if it fits your use case. Regards, -- Nicolas Goaziou --=-=-= Content-Type: text/x-diff Content-Disposition: attachment; filename=0001-Small-fix-to-emphasis-fontification.patch >From 52e4c5e1e69b0aaef1795289d8cf9456e76716f1 Mon Sep 17 00:00:00 2001 From: Nicolas Goaziou Date: Sat, 18 Nov 2017 00:19:35 +0100 Subject: [PATCH] Small fix to emphasis fontification * lisp/org.el (org-do-emphasis-faces): Do not span over paragraph separators. Reported-by: Kaushal Modi --- lisp/org.el | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/lisp/org.el b/lisp/org.el index f873f1021..861ce31db 100644 --- a/lisp/org.el +++ b/lisp/org.el @@ -5705,20 +5705,16 @@ This should be called after the variable `org-link-parameters' has changed." (when (save-excursion (goto-char (match-beginning 0)) (and - ;; Do not match headline stars. Do not consider - ;; stars of a headline as closing marker for bold - ;; markup either. - (not (and (equal marker "*") - (save-excursion - (forward-char) - (skip-chars-backward "*") - (looking-at-p org-outline-regexp-bol)))) ;; Do not match table hlines. (not (and (equal marker "+") (org-match-line - "^[ \t]*\\(|[-+]+|?\\|\\+[-+]+\\+\\)[ \t]*$"))) + "[ \t]*\\(|[-+]+|?\\|\\+[-+]+\\+\\)[ \t]*$"))) + ;; Match full emphasis markup regexp. (looking-at (if verbatim? org-verbatim-re org-emph-re)) - ;; At a table row, do not cross cell boundaries. + ;; Do not span over paragraph boundaries. + (not (string-match-p org-element-paragraph-separate + (match-string 2))) + ;; Do not span over cells in table rows. (not (and (save-match-data (org-match-line "[ \t]*|")) (string-match-p "|" (match-string 4)))))) (pcase-let ((`(,_ ,face ,_) (assoc marker org-emphasis-alist))) -- 2.14.3 --=-=-=--