element: Small speed-up in object parsing

* lisp/org-element.el (org-element--object-lex): Branch earlier for
footnote references.
This commit is contained in:
Nicolas Goaziou 2020-04-25 14:38:22 +02:00
parent 8173884a13
commit 94c2ef7d09

View file

@ -4497,15 +4497,18 @@ to an appropriate container (e.g., a paragraph)."
(and (memq 'latex-fragment restriction)
(org-element-latex-fragment-parser)))))
(?\[
(if (eq (aref result 1) ?\[)
(and (memq 'link restriction)
(org-element-link-parser))
(or (and (memq 'footnote-reference restriction)
(org-element-footnote-reference-parser))
(and (memq 'timestamp restriction)
(org-element-timestamp-parser))
(and (memq 'statistics-cookie restriction)
(org-element-statistics-cookie-parser)))))
(pcase (aref result 1)
((and ?\[
(guard (memq 'link restriction)))
(org-element-link-parser))
((and ?f
(guard (memq 'footnote-reference restriction)))
(org-element-footnote-reference-parser))
(_
(or (and (memq 'timestamp restriction)
(org-element-timestamp-parser))
(and (memq 'statistics-cookie restriction)
(org-element-statistics-cookie-parser))))))
;; This is probably a plain link.
(_ (and (memq 'link restriction)
(org-element-link-parser)))))))