Tiny speed-up for `org-entry-properties'
* lisp/org.el (org-entry-properties): Tiny speed-up. * testing/lisp/test-org.el (test-org/entry-properties): Add test.
This commit is contained in:
parent
dd7f8af9f5
commit
739853d128
17
lisp/org.el
17
lisp/org.el
|
@ -15642,7 +15642,8 @@ strings."
|
|||
(when specific (throw 'exit props)))
|
||||
(when (or (not specific) (string= specific "PRIORITY"))
|
||||
(when (looking-at org-priority-regexp)
|
||||
(push (cons "PRIORITY" (org-match-string-no-properties 2)) props))
|
||||
(push (cons "PRIORITY" (org-match-string-no-properties 2))
|
||||
props))
|
||||
(when specific (throw 'exit props)))
|
||||
(when (or (not specific) (string= specific "FILE"))
|
||||
(push (cons "FILE" (buffer-file-name (buffer-base-buffer)))
|
||||
|
@ -15689,10 +15690,16 @@ strings."
|
|||
(member specific '("TIMESTAMP" "TIMESTAMP_IA")))
|
||||
(let ((find-ts
|
||||
(lambda (end ts)
|
||||
(let ((regexp (if (or (string= specific "TIMESTAMP")
|
||||
(assoc "TIMESTAMP_IA" ts))
|
||||
org-ts-regexp
|
||||
org-ts-regexp-both)))
|
||||
(let ((regexp (cond
|
||||
((string= specific "TIMESTAMP")
|
||||
org-ts-regexp)
|
||||
((string= specific "TIMESTAMP_IA")
|
||||
org-ts-regexp-inactive)
|
||||
((assoc "TIMESTAMP_IA" ts)
|
||||
org-ts-regexp)
|
||||
((assoc "TIMESTAMP" ts)
|
||||
org-ts-regexp-inactive)
|
||||
(t org-ts-regexp-both))))
|
||||
(catch 'next
|
||||
(while (re-search-forward regexp end t)
|
||||
(backward-char)
|
||||
|
|
|
@ -3164,6 +3164,23 @@ Text.
|
|||
"\n"
|
||||
"** H2\n:PROPERTIES:\n:CATEGORY: cat2\n:END:<point>")
|
||||
(cdr (assoc "CATEGORY" (org-entry-properties nil "CATEGORY"))))))
|
||||
;; Get "TIMESTAMP" and "TIMESTAMP_IA" properties.
|
||||
(should
|
||||
(equal "<2012-03-29 thu.>"
|
||||
(org-test-with-temp-text "* Entry\n<2012-03-29 thu.>"
|
||||
(cdr (assoc "TIMESTAMP" (org-entry-properties))))))
|
||||
(should
|
||||
(equal "[2012-03-29 thu.]"
|
||||
(org-test-with-temp-text "* Entry\n[2012-03-29 thu.]"
|
||||
(cdr (assoc "TIMESTAMP_IA" (org-entry-properties))))))
|
||||
(should
|
||||
(equal "<2012-03-29 thu.>"
|
||||
(org-test-with-temp-text "* Entry\n[2014-03-04 tue.]<2012-03-29 thu.>"
|
||||
(cdr (assoc "TIMESTAMP" (org-entry-properties nil "TIMESTAMP"))))))
|
||||
(should
|
||||
(equal "[2014-03-04 tue.]"
|
||||
(org-test-with-temp-text "* Entry\n<2012-03-29 thu.>[2014-03-04 tue.]"
|
||||
(cdr (assoc "TIMESTAMP_IA" (org-entry-properties nil "TIMESTAMP_IA"))))))
|
||||
;; Get standard properties.
|
||||
(should
|
||||
(equal "1"
|
||||
|
|
Loading…
Reference in New Issue