From mboxrd@z Thu Jan 1 00:00:00 1970 From: Pavel Panchekha Subject: Entities Parsing Code Date: Mon, 19 Sep 2011 17:39:27 -0400 Message-ID: Mime-Version: 1.0 Content-Type: multipart/alternative; boundary=bcaec501643969580604ad522d4f Return-path: Received: from eggs.gnu.org ([140.186.70.92]:35257) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1R5lYo-0001Lw-SD for emacs-orgmode@gnu.org; Mon, 19 Sep 2011 17:39:32 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1R5lYn-0005hP-TG for emacs-orgmode@gnu.org; Mon, 19 Sep 2011 17:39:30 -0400 Received: from mail-wy0-f171.google.com ([74.125.82.171]:47859) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1R5lYn-0005hB-Jy for emacs-orgmode@gnu.org; Mon, 19 Sep 2011 17:39:29 -0400 Received: by wyh13 with SMTP id 13so7653438wyh.30 for ; Mon, 19 Sep 2011 14:39:28 -0700 (PDT) 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: emacs-orgmode@gnu.org --bcaec501643969580604ad522d4f Content-Type: text/plain; charset=UTF-8 I've been noticing that the org-pretty-entities code incorrectly lexes numbers as part of TeX command names; for example, if I type $\sim2n^2$, the \sim will not be replaced with a ~ because the 2 is lexed as part of the command name. This is incorrect; in TeX, numbers are not legal parts of a command name. Here's a patch that fixes the issue: diff --git a/lisp/org.el b/lisp/org.el index 73b1073..0db5a0b 100644 --- a/lisp/org.el +++ b/lisp/org.el @@ -5735,7 +5735,7 @@ needs to be inserted at a specific position in the font- (when org-pretty-entities (catch 'match (while (re-search-forward - "\\\\\\([a-zA-Z][a-zA-Z0-9]*\\)\\($\\|[^[:alnum:]\n]\\)" + "\\\\\\([a-zA-Z]+\\)\\($\\|[^[:alpha:]\n]\\)" limit t) (if (and (not (org-in-indented-comment-line)) (setq ee (org-entity-get (match-string 1))) -- - Pavel Panchekha --bcaec501643969580604ad522d4f Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable I've been noticing that the org-pretty-entities code incorrectly lexes = numbers as part of TeX command names; for example, if I type $\sim2n^2$, th= e \sim will not be replaced with a ~ because the 2 is lexed as part of the = command name.=C2=A0 This is incorrect; in TeX, numbers are not legal parts = of a command name.

Here's a patch that fixes the issue:

diff --git a/lisp/org.el b/lisp/org.el<= br style=3D"font-family: courier new,monospace;">index 73b1073..0db5a0b 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -5735,7 +5735,7 @@ n= eeds to be inserted at a specific position in the font-
=C2=A0=C2=A0=C2=A0=C2=A0 (when org-pretty-entities
=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0 (catch 'match
=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 (while (re-search-forward
-=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 "\\\\\= \([a-zA-Z][a-zA-Z0-9]*\\)\\($\\|[^[:alnum:]\n]\\)"
+=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0 "\\\\\\([a-zA-Z]+\\)\\($\\|[^[:alpha:]\n]\\)&= quot;
=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 limit= t)
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0 (if (and (not (org-in-indented-comment-line))
=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0 (setq ee (org-entity-get (match-string 1)))

--
- Pavel Panchekha

--bcaec501643969580604ad522d4f--