From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Mark E. Shoulson" Subject: Hiding the braces when org-pretty-entities is enabled Date: Fri, 04 May 2012 18:24:29 -0400 Message-ID: <4FA4571D.4050402@kli.org> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="------------020602030708060909020303" Return-path: Received: from eggs.gnu.org ([208.118.235.92]:52949) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SQQvZ-0007O4-Bi for emacs-orgmode@gnu.org; Fri, 04 May 2012 18:24:43 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SQQvX-00027V-Fh for emacs-orgmode@gnu.org; Fri, 04 May 2012 18:24:40 -0400 Received: from pi.meson.org ([96.56.207.26]:51488) by eggs.gnu.org with smtp (Exim 4.71) (envelope-from ) id 1SQQvX-000266-AV for emacs-orgmode@gnu.org; Fri, 04 May 2012 18:24:39 -0400 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-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: org-mode mailing list This is a multi-part message in MIME format. --------------020602030708060909020303 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit

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

--------------020602030708060909020303 Content-Type: text/x-patch; name="0001-Entities-when-org-pretty-entities-is-on-the-terminat.patch" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename*0="0001-Entities-when-org-pretty-entities-is-on-the-terminat.pa"; filename*1="tch" >From 819e66254de18ae78e96b52dee1b5098920c3e31 Mon Sep 17 00:00:00 2001 From: Mark Shoulson 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 --------------020602030708060909020303--