Browse Source

Fix infloop when user provides a wrong value for `org-highlight-latex-and-related'

* lisp/org.el (org-do-latex-and-related): Fix infloop when user
  provides a wrong value for `org-highlight-latex-and-related'. In
  this case, `org-latex-and-related-regexp' is the empty string and
  generates an infloop since matching it doesn't move point.
Nicolas Goaziou 5 years ago
parent
commit
c086ea0832
1 changed files with 1 additions and 1 deletions
  1. 1 1
      lisp/org.el

+ 1 - 1
lisp/org.el

@@ -5913,7 +5913,7 @@ Result depends on variable `org-highlight-latex-and-related'."
 LIMIT bounds the search for syntax to highlight.  Stop at first
 highlighted object, if any.  Return t if some highlighting was
 done, nil otherwise."
-  (when org-highlight-latex-and-related
+  (when (org-string-nw-p org-latex-and-related-regexp)
     (catch 'found
       (while (re-search-forward org-latex-and-related-regexp limit t)
 	(unless (memq (car-safe (get-text-property (1+ (match-beginning 0))