From 11033a97dc340db7c38c68f2e78dd78230bd7b1c Mon Sep 17 00:00:00 2001 From: Nicolas Goaziou Date: Mon, 25 Feb 2013 21:30:16 +0100 Subject: [PATCH] sub/superscript character has to follow a non-blank character * lisp/org.el (org-match-substring-regexp, org-match-substring-with-braces-regexp): Update regexp. A sub/superscript cannot start anymore at the beginning of the line or after a space. --- lisp/org.el | 4 ++-- testing/lisp/test-org-element.el | 12 ------------ 2 files changed, 2 insertions(+), 14 deletions(-) diff --git a/lisp/org.el b/lisp/org.el index cdcb7df85..f61acc7f4 100644 --- a/lisp/org.el +++ b/lisp/org.el @@ -5413,7 +5413,7 @@ stacked delimiters is N. Escaping delimiters is not possible." (defvar org-match-substring-regexp (concat - "\\([^\\]\\|^\\)\\([_^]\\)\\(" + "\\(\\S-\\)\\([_^]\\)\\(" "\\(" (org-create-multibrace-regexp "{" "}" org-match-sexp-depth) "\\)" "\\|" "\\(" (org-create-multibrace-regexp "(" ")" org-match-sexp-depth) "\\)" @@ -5423,7 +5423,7 @@ stacked delimiters is N. Escaping delimiters is not possible." (defvar org-match-substring-with-braces-regexp (concat - "\\([^\\]\\|^\\)\\([_^]\\)\\(" + "\\(\\S-\\)\\([_^]\\)\\(" "\\(" (org-create-multibrace-regexp "{" "}" org-match-sexp-depth) "\\)" "\\)") "The regular expression matching a sub- or superscript, forcing braces.") diff --git a/testing/lisp/test-org-element.el b/testing/lisp/test-org-element.el index c979715e6..5a08b9ed0 100644 --- a/testing/lisp/test-org-element.el +++ b/testing/lisp/test-org-element.el @@ -1684,12 +1684,6 @@ Outside list" (should (org-test-with-temp-text "a_{b}" (org-element-map (org-element-parse-buffer) 'subscript 'identity))) - ;; At the beginning of an item. - (should - (eq 'subscript - (org-test-with-temp-text "- _b" - (progn (search-forward "_") - (org-element-type (org-element-context)))))) ;; Multiple subscripts in a paragraph. (should (= 2 @@ -1710,12 +1704,6 @@ Outside list" (should (org-test-with-temp-text "a^{b}" (org-element-map (org-element-parse-buffer) 'superscript 'identity))) - ;; At the beginning of an item. - (should - (eq 'superscript - (org-test-with-temp-text "- ^b" - (progn (search-forward "^") - (org-element-type (org-element-context)))))) ;; Multiple superscript in a paragraph. (should (= 2 -- 2.11.4.GIT