emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Nicolas Goaziou <mail@nicolasgoaziou.fr>
To: Kaushal Modi <kaushal.modi@gmail.com>
Cc: emacs-org list <emacs-orgmode@gnu.org>
Subject: Re: Org emphasis markers inside src blocks causes incorrect fontification
Date: Sat, 18 Nov 2017 00:30:02 +0100	[thread overview]
Message-ID: <87h8tstret.fsf@nicolasgoaziou.fr> (raw)
In-Reply-To: <CAFyQvY2Eb63D35EmXBQg+q1ztaPCk4EzVRf2EOrmgAjOjZOxDA@mail.gmail.com> (Kaushal Modi's message of "Thu, 16 Nov 2017 21:56:56 +0000")

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

Hello,

Kaushal Modi <kaushal.modi@gmail.com> 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

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-Small-fix-to-emphasis-fontification.patch --]
[-- Type: text/x-diff, Size: 1841 bytes --]

From 52e4c5e1e69b0aaef1795289d8cf9456e76716f1 Mon Sep 17 00:00:00 2001
From: Nicolas Goaziou <mail@nicolasgoaziou.fr>
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 <kaushal.modi@gmail.com>
<http://lists.gnu.org/archive/html/emacs-orgmode/2017-11/msg00202.html>
---
 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


  reply	other threads:[~2017-11-17 23:30 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-11-16 20:08 Org emphasis markers inside src blocks causes incorrect fontification Kaushal Modi
2017-11-16 21:47 ` Nicolas Goaziou
2017-11-16 21:56   ` Kaushal Modi
2017-11-17 23:30     ` Nicolas Goaziou [this message]
2017-11-20 17:34       ` Kaushal Modi
2017-11-25 14:42         ` Nicolas Goaziou

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://www.orgmode.org/

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

  git send-email \
    --in-reply-to=87h8tstret.fsf@nicolasgoaziou.fr \
    --to=mail@nicolasgoaziou.fr \
    --cc=emacs-orgmode@gnu.org \
    --cc=kaushal.modi@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
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).