From mboxrd@z Thu Jan 1 00:00:00 1970 From: Aaron Ecay Subject: [parser] subscripts and underlines interacting badly Date: Tue, 10 Dec 2013 21:30:07 -0500 Message-ID: <87ppp415n4.fsf@gmail.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:33622) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VqZZF-0002rV-Rd for emacs-orgmode@gnu.org; Tue, 10 Dec 2013 21:30:38 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VqZZ7-0006CV-Bn for emacs-orgmode@gnu.org; Tue, 10 Dec 2013 21:30:29 -0500 Received: from mail-qc0-x229.google.com ([2607:f8b0:400d:c01::229]:33446) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VqZZ7-0006CF-68 for emacs-orgmode@gnu.org; Tue, 10 Dec 2013 21:30:21 -0500 Received: by mail-qc0-f169.google.com with SMTP id r5so4778314qcx.0 for ; Tue, 10 Dec 2013 18:30:18 -0800 (PST) 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" Cc: Nicolas Goaziou --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Hello, I have encountered two related misbehaviors in the parser/exporter. The first manifests if you type the following line into an org-mode buffer and execute M-: (org-element-context) with point on the =E2=80=98f= =E2=80=99; the result is a subscript object, whereas I would have expected an underline: '_foo_ I think both possibilities are returned by org-element--get-next-object-candidates, and subscript =E2=80=9Cwins=E2=80= =9D because it precedes the other in the list. I=E2=80=99m not sure how this should be addressed, but maybe Nicolas knows. I encountered the second issue when trying to hack around the first by setting org-use-sub-superscripts to '{}. It seems this variable is not considered by the parser. I think the attached patch fixes this issue. Thanks, --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=0001-org-element-respect-the-org-use-sub-superscripts-var.patch >From f5f6d10e5d55f68d57abd2f7a947f72cb90081d0 Mon Sep 17 00:00:00 2001 From: Aaron Ecay Date: Tue, 10 Dec 2013 21:19:23 -0500 Subject: [PATCH] org-element: respect the `org-use-sub-superscripts' variable * lisp/org-element.el (org-element-sub/superscript-successor): respect the `org-use-sub-superscripts' variable --- lisp/org-element.el | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/lisp/org-element.el b/lisp/org-element.el index 9183a67..d0e6bf9 100644 --- a/lisp/org-element.el +++ b/lisp/org-element.el @@ -3394,11 +3394,15 @@ CONTENTS is the contents of the object." Return value is a cons cell whose CAR is either `subscript' or `superscript' and CDR is beginning position." - (save-excursion - (unless (bolp) (backward-char)) - (when (re-search-forward org-match-substring-regexp nil t) - (cons (if (string= (match-string 2) "_") 'subscript 'superscript) - (match-beginning 2))))) + (when org-use-sub-superscripts + (save-excursion + (unless (bolp) (backward-char)) + (when (re-search-forward (if (eq org-use-sub-superscripts '{}) + org-match-substring-with-braces-regexp + org-match-substring-regexp) + nil t) + (cons (if (string= (match-string 2) "_") 'subscript 'superscript) + (match-beginning 2)))))) ;;;; Superscript -- 1.8.5.1 --=-=-= Content-Type: text/plain -- Aaron Ecay --=-=-=--