浏览代码

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.
Nicolas Goaziou 12 年之前
父节点
当前提交
11033a97dc
共有 2 个文件被更改,包括 2 次插入14 次删除
  1. 2 2
      lisp/org.el
  2. 0 12
      testing/lisp/test-org-element.el

+ 2 - 2
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.")

+ 0 - 12
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