[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[O] [parser] subscripts and underlines interacting badly
From: |
Aaron Ecay |
Subject: |
[O] [parser] subscripts and underlines interacting badly |
Date: |
Tue, 10 Dec 2013 21:30:07 -0500 |
User-agent: |
Notmuch/0.16+154~g96c0ce2 (http://notmuchmail.org) Emacs/24.3.50.1 (x86_64-unknown-linux-gnu) |
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 ‘f’; 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 “wins” because it
precedes the other in the list. I’m 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,
>From f5f6d10e5d55f68d57abd2f7a947f72cb90081d0 Mon Sep 17 00:00:00 2001
From: Aaron Ecay <address@hidden>
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
--
Aaron Ecay
- [O] [parser] subscripts and underlines interacting badly,
Aaron Ecay <=
- Re: [O] [parser] subscripts and underlines interacting badly, Nicolas Goaziou, 2013/12/11
- Re: [O] [parser] subscripts and underlines interacting badly, Aaron Ecay, 2013/12/11
- Re: [O] [parser] subscripts and underlines interacting badly, Nicolas Goaziou, 2013/12/11
- Re: [O] [parser] subscripts and underlines interacting badly, Aaron Ecay, 2013/12/12
- Re: [O] [parser] subscripts and underlines interacting badly, Nicolas Goaziou, 2013/12/12
- Re: [O] [parser] subscripts and underlines interacting badly, Aaron Ecay, 2013/12/12
- Re: [O] [parser] subscripts and underlines interacting badly, Nicolas Goaziou, 2013/12/12
- Re: [O] [parser] subscripts and underlines interacting badly, Aaron Ecay, 2013/12/15
- [O] [PATCH] quick patch to org-habit todo state keywords, Ted Wiles, 2013/12/15
- Re: [O] [PATCH] quick patch to org-habit todo state keywords, Aaron Ecay, 2013/12/15