emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Bug: font-lock error with - in code-mode [9.4.6 (9.4.6-gab9f2a @ /gn


From: Ihor Radchenko
Subject: Re: Bug: font-lock error with - in code-mode [9.4.6 (9.4.6-gab9f2a @ /gnu/store/2pny4z6mbi2aybgzzxz0yrzkds7hbpmq-emacs-org-9.4.6/share/emacs/site-lisp/org-9.4.6/)]
Date: Fri, 01 Oct 2021 17:56:32 +0800

"Dr. Arne Babenhauserheide" <arne_bab@web.de> writes:

> When parsing the following code:
>
> Am richtigen Ort zur richtigen Zeit (=+=; 1x pro Abenteuer im richtigen
> Moment auftauchen), Computeraffinität (=+= oder =++=; Bonus von 3 oder 6),
> Kurze Aufmerksamskeitsspanne (~-~), Photographisches Gedächtnis (=+=),
> Primitive Technologie (~-~), Schreckhaft (~-~), Schrecklich Schusselig (~-~),
> Toller Laptop (=+=) oder Verträumt (~-~).
>
> The fourth line is highlighted as code beginning at the first ~-~ until
> the final closing paren (")")  of the paragraph.

Confirmed

The fix is attached.

Best,
Ihor

>From a4c864b7f983a135e8debbc32d8ef4ff3f2e89f4 Mon Sep 17 00:00:00 2001
Message-Id: 
<a4c864b7f983a135e8debbc32d8ef4ff3f2e89f4.1633082097.git.yantar92@gmail.com>
From: Ihor Radchenko <yantar92@gmail.com>
Date: Fri, 1 Oct 2021 17:47:02 +0800
Subject: [PATCH] org-do-emphasis-faces: Never treat closing marker as next
 opening marker

* lisp/org.el (org-do-emphasis-faces): Make sure that we never match
ending marker of an emphasis as a beginning marker of another
emphasis.  For example, in "(~-~) test (~+~)" "~) test (~" is a valid
code match unless we move point to the end the first code emphasis
completely during parsing.

Fixes https://orgmode.org/list/87fsujp7mc.fsf@web.de
---
 lisp/org.el | 1 +
 1 file changed, 1 insertion(+)

diff --git a/lisp/org.el b/lisp/org.el
index 9608b52ee..9f68182d9 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -4855,6 +4855,7 @@ (defun org-do-emphasis-faces (limit)
                                       '(invisible t))
                  (add-text-properties (match-beginning 3) (match-end 3)
                                       '(invisible t)))
+                (goto-char (match-end 0))
                (throw :exit t)))))))))
 
 (defun org-emphasize (&optional char)
-- 
2.32.0


reply via email to

[Prev in Thread] Current Thread [Next in Thread]