[Org] Hack: don’t read all properties of an entry when asking only for one

This commit is contained in:
Daniel - 2018-09-12 17:08:28 +02:00
parent 21a662cf4f
commit c48bb8d3da
Signed by: dbo
GPG Key ID: 4F63DB96D45AA9C6
1 changed files with 20 additions and 0 deletions

View File

@ -1004,6 +1004,26 @@ Current Task: %`org-clock-current-task; "
(format "hy %s" tempfile))
(delete-file tempfile))))
;;; Hacks
;; The default implementation is too slow, because it is parsing all properties
;; of an entry by default. Lets simplify this to only parse what we are
;; looking for. This makes tag search *much* faster!
(with-eval-after-load 'org
(defun org-cached-entry-get (pom property)
(if (or (eq t org-use-property-inheritance)
(and (stringp org-use-property-inheritance)
(let ((case-fold-search t))
(string-match-p org-use-property-inheritance property)))
(and (listp org-use-property-inheritance)
(member-ignore-case property org-use-property-inheritance)))
;; Caching is not possible, check it directly.
(org-entry-get pom property 'inherit)
;; This is different in the original implementation
(org-entry-properties pom property))))
;;; End