diff options
author | Nicolas Goaziou <mail@nicolasgoaziou.fr> | 2017-05-13 09:21:31 +0200 |
---|---|---|
committer | Nicolas Goaziou <mail@nicolasgoaziou.fr> | 2017-05-13 09:21:31 +0200 |
commit | b72d29d685b5abe747466854151977b2c632cb1c (patch) | |
tree | c553ed29611437efa8d431491967e66f0c36d56b | |
parent | 79ac71d175aa0492cc7a58c05ed23539ca8959bc (diff) | |
parent | c0369a798470763f8f3c69cf2079c3a194635feb (diff) | |
download | org-mode-b72d29d685b5abe747466854151977b2c632cb1c.tar.gz |
Merge branch 'maint'
-rw-r--r-- | lisp/org-element.el | 3 | ||||
-rw-r--r-- | lisp/org.el | 6 | ||||
-rw-r--r-- | testing/lisp/test-org-element.el | 4 |
3 files changed, 9 insertions, 4 deletions
diff --git a/lisp/org-element.el b/lisp/org-element.el index db74441..12a4bc6 100644 --- a/lisp/org-element.el +++ b/lisp/org-element.el @@ -3039,7 +3039,8 @@ Assume point is at the beginning of the LaTeX fragment." (search-forward "$" nil t 2) (not (memq (char-before (match-beginning 0)) '(?\s ?\t ?\n ?, ?.))) - (looking-at "\\(\\s.\\|\\s-\\|\\s(\\|\\s)\\|\\s\"\\|$\\)") + (looking-at-p + "\\(\\s.\\|\\s-\\|\\s(\\|\\s)\\|\\s\"\\|'\\|$\\)") (point))) (pcase (char-after (1+ (point))) (?\( (search-forward "\\)" nil t)) diff --git a/lisp/org.el b/lisp/org.el index c46c3c1..482c4fe 100644 --- a/lisp/org.el +++ b/lisp/org.el @@ -536,10 +536,10 @@ An entry can be toggled between COMMENT and normal with (defconst org-latex-regexps '(("begin" "^[ \t]*\\(\\\\begin{\\([a-zA-Z0-9\\*]+\\)[^\000]+?\\\\end{\\2}\\)" 1 t) - ;; ("$" "\\([ (]\\|^\\)\\(\\(\\([$]\\)\\([^ \r\n,.$].*?\\(\n.*?\\)\\{0,5\\}[^ \r\n,.$]\\)\\4\\)\\)\\([ .,?;:'\")]\\|$\\)" 2 nil) + ;; ("$" "\\([ \t(]\\|^\\)\\(\\(\\([$]\\)\\([^ \t\n,.$].*?\\(\n.*?\\)\\{0,5\\}[^ \t\n,.$]\\)\\4\\)\\)\\([ \t.,?;:'\")]\\|$\\)" 2 nil) ;; \000 in the following regex is needed for org-inside-LaTeX-fragment-p - ("$1" "\\([^$]\\|^\\)\\(\\$[^ \r\n,;.$]\\$\\)\\(\\s.\\|\\s-\\|\\s(\\|\\s)\\|\\s\"\\|\000\\|$\\)" 2 nil) - ("$" "\\([^$]\\|^\\)\\(\\(\\$\\([^ \r\n,;.$][^$\n\r]*?\\(\n[^$\n\r]*?\\)\\{0,2\\}[^ \r\n,.$]\\)\\$\\)\\)\\(\\s.\\|\\s-\\|\\s(\\|\\s)\\|\\s\"\\|\000\\|$\\)" 2 nil) + ("$1" "\\([^$]\\|^\\)\\(\\$[^ \t\r\n,;.$]\\$\\)\\(\\s.\\|\\s-\\|\\s(\\|\\s)\\|\\s\"\\|\000\\|'\\|$\\)" 2 nil) + ("$" "\\([^$]\\|^\\)\\(\\(\\$\\([^ \t\n,;.$][^$\n\r]*?\\(\n[^$\n\r]*?\\)\\{0,2\\}[^ \t\n,.$]\\)\\$\\)\\)\\(\\s.\\|\\s-\\|\\s(\\|\\s)\\|\\s\"\\|\000\\|'\\|$\\)" 2 nil) ("\\(" "\\\\([^\000]*?\\\\)" 0 nil) ("\\[" "\\\\\\[[^\000]*?\\\\\\]" 0 nil) ("$$" "\\$\\$[^\000]*?\\$\\$" 0 nil)) diff --git a/testing/lisp/test-org-element.el b/testing/lisp/test-org-element.el index bbc2618..3e43938 100644 --- a/testing/lisp/test-org-element.el +++ b/testing/lisp/test-org-element.el @@ -1555,6 +1555,10 @@ e^{i\\pi}+1=0 (eq 'latex-fragment (org-test-with-temp-text "$a$ " (org-element-type (org-element-context))))) + (should + (eq 'latex-fragment + (org-test-with-temp-text "$a$'" + (org-element-type (org-element-context))))) (should-not (eq 'latex-fragment (org-test-with-temp-text "$a$a" |