diff options
| author | Nicolas Goaziou <mail@nicolasgoaziou.fr> | 2021-10-23 11:18:10 +0200 |
|---|---|---|
| committer | Nicolas Goaziou <mail@nicolasgoaziou.fr> | 2021-10-23 11:18:10 +0200 |
| commit | d3143feaf7707f5b83def0723cc2130d9ecaaf59 (patch) | |
| tree | 65f98fb1e3149b1ded0f26da85c3ab5e2bbcf1a8 | |
| parent | 6ca685c3c566ccdee917f8d620d1185fc3282646 (diff) | |
| download | org-mode-d3143feaf7707f5b83def0723cc2130d9ecaaf59.tar.gz | |
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.
| -rw-r--r-- | lisp/org.el | 2 | ||||
| -rw-r--r-- | testing/lisp/test-org.el | 5 |
2 files changed, 6 insertions, 1 deletions
diff --git a/lisp/org.el b/lisp/org.el index 474171b55..0a83c00fc 100644 --- a/lisp/org.el +++ b/lisp/org.el @@ -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) diff --git a/testing/lisp/test-org.el b/testing/lisp/test-org.el index f7c84ba1b..47a5f565f 100644 --- a/testing/lisp/test-org.el +++ b/testing/lisp/test-org.el @@ -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 |
