Fix sloppiness when collecting keywords
* lisp/org.el (org--collect-keywords-1): Use an accurate function instead of an approximation. Accuracy trumps speed when parsing. * testing/lisp/test-org.el (test-org/collect-keywords): New test.
This commit is contained in:
parent
6ca685c3c5
commit
d3143feaf7
|
@ -4544,7 +4544,7 @@ directory."
|
|||
(let ((case-fold-search t)
|
||||
(regexp (org-make-options-regexp keywords)))
|
||||
(while (and keywords (re-search-forward regexp nil t))
|
||||
(let ((element (org-with-point-at (match-beginning 0) (org-element-keyword-parser (line-end-position) (list (match-beginning 0))))))
|
||||
(let ((element (org-element-at-point)))
|
||||
(when (eq 'keyword (org-element-type element))
|
||||
(let ((value (org-element-property :value element)))
|
||||
(pcase (org-element-property :key element)
|
||||
|
|
|
@ -2648,6 +2648,11 @@ SCHEDULED: <2014-03-04 tue.>"
|
|||
(org-mode-restart)
|
||||
(cdr (assoc "a" org-keyword-properties))))))
|
||||
|
||||
(ert-deftest test-org/collect-keywords ()
|
||||
"Test `org-collect-keywords'."
|
||||
(should-not
|
||||
(org-test-with-temp-text "#+begin_example\n#+foo: bar\n#+end_example"
|
||||
(org-collect-keywords '("FOO")))))
|
||||
|
||||
|
||||
;;; Links
|
||||
|
|
Loading…
Reference in New Issue