It's a very tiny patch, but one that probably should have happened before.  When org-pretty-entities is enabled, the entities are displayed as Unicode characters, which is nice, but if they are in the middle of a word, you need to terminate them with {}, which are also still visible.  So you have to write something like M\ouml{}bius, and when org-pretty-entities is on that is displayed as Mö{}bius, which really isn't what you want.  This patch special-cases "{}" following an entity, so they get hidden as well.  Hope it helps.


~mark

>From 819e66254de18ae78e96b52dee1b5098920c3e31 Mon Sep 17 00:00:00 2001
From: Mark Shoulson <m...@kli.org>
Date: Fri, 4 May 2012 18:19:06 -0400
Subject: [PATCH] Entities: when org-pretty-entities is on, the {} terminating
 entities is also hidden

---
 lisp/org.el |   11 +++++++----
 1 files changed, 7 insertions(+), 4 deletions(-)

diff --git a/lisp/org.el b/lisp/org.el
index 8776664..65dc1ce 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -5938,16 +5938,19 @@ needs to be inserted at a specific position in the font-lock sequence.")
     (when org-pretty-entities
       (catch 'match
 	(while (re-search-forward
-		"\\\\\\(frac[13][24]\\|[a-zA-Z]+\\)\\($\\|[^[:alpha:]\n]\\)"
+		"\\\\\\(frac[13][24]\\|[a-zA-Z]+\\)\\($\\|{}\\|[^[:alpha:]\n]\\)"
 		limit t)
 	  (if (and (not (org-in-indented-comment-line))
 		   (setq ee (org-entity-get (match-string 1)))
 		   (= (length (nth 6 ee)) 1))
-	      (progn
+	      (let*
+		  ((end (if (equal (match-string 2) "{}")
+			    (match-end 2)
+			  (match-end 1))))
 		(add-text-properties
-		 (match-beginning 0) (match-end 1)
+		 (match-beginning 0) end
 		 (list 'font-lock-fontified t))
-		(compose-region (match-beginning 0) (match-end 1)
+		(compose-region (match-beginning 0) end
 				(nth 6 ee) nil)
 		(backward-char 1)
 		(throw 'match t))))
-- 
1.7.7.6

Reply via email to