diff --git a/README.org b/README.org index b89765a..fe68a62 100644 --- a/README.org +++ b/README.org @@ -550,6 +550,7 @@ Simple links may also be written manually in either sexp or non-sexp form, like: *Internal* + Certain query predicates, when called multiple times in an ~and~ sub-expression, are optimized to a single call. ++ Use ~buffer-chars-modified-tick~ instead of ~buffer-modified-tick~. (Thanks to [[https://github.com/yantar92][Ihor Radchenko]].) ** 0.6.2 diff --git a/org-ql.el b/org-ql.el index 39e4215..52c9b72 100644 --- a/org-ql.el +++ b/org-ql.el @@ -481,7 +481,7 @@ NARROW corresponds to the `org-ql-select' argument NARROW." (if-let* ((buffer-cache (gethash (current-buffer) org-ql-cache)) (query-cache (cadr buffer-cache)) (modified-tick (car buffer-cache)) - (buffer-unmodified-p (eq (buffer-modified-tick) modified-tick)) + (buffer-unmodified-p (eq (buffer-chars-modified-tick) modified-tick)) (cached-result (gethash query-cache-key query-cache))) (pcase cached-result ('org-ql-nil nil) @@ -490,7 +490,7 @@ NARROW corresponds to the `org-ql-select' argument NARROW." (cond ((or (not query-cache) (not buffer-unmodified-p)) (puthash (current-buffer) - (list (buffer-modified-tick) + (list (buffer-chars-modified-tick) (let ((table (make-hash-table :test 'org-ql-hash-test))) (puthash query-cache-key (or new-result 'org-ql-nil) table) table)) @@ -545,7 +545,7 @@ Returns cons (INHERITED-TAGS . LOCAL-TAGS)." (if-let* ((buffer-cache (gethash (current-buffer) org-ql-tags-cache)) (modified-tick (car buffer-cache)) (tags-cache (cdr buffer-cache)) - (buffer-unmodified-p (eq (buffer-modified-tick) modified-tick)) + (buffer-unmodified-p (eq (buffer-chars-modified-tick) modified-tick)) (cached-result (gethash position tags-cache))) ;; Found in cache: return them. ;; FIXME: Isn't `cached-result' a list of (INHERITED . LOCAL)? It @@ -586,12 +586,12 @@ Returns cons (INHERITED-TAGS . LOCAL-TAGS)." (setf buffer-cache (gethash (current-buffer) org-ql-tags-cache) modified-tick (car buffer-cache) tags-cache (cdr buffer-cache) - buffer-unmodified-p (eq (buffer-modified-tick) modified-tick)) + buffer-unmodified-p (eq (buffer-chars-modified-tick) modified-tick)) (unless (and buffer-cache buffer-unmodified-p) ;; Buffer-local tags cache empty or invalid: make new one. (setf tags-cache (make-hash-table)) (puthash (current-buffer) - (cons (buffer-modified-tick) tags-cache) + (cons (buffer-chars-modified-tick) tags-cache) org-ql-tags-cache)) (puthash position all-tags tags-cache)))) @@ -622,7 +622,7 @@ Values compared with `equal'." (pcase (if-let* ((buffer-cache (gethash (current-buffer) org-ql-node-value-cache)) (modified-tick (car buffer-cache)) (position-cache (cdr buffer-cache)) - (buffer-unmodified-p (eq (buffer-modified-tick) modified-tick)) + (buffer-unmodified-p (eq (buffer-chars-modified-tick) modified-tick)) (value-cache (gethash position position-cache)) (cached-value (alist-get fn value-cache nil nil #'equal))) ;; Found in cache: return it. @@ -637,13 +637,13 @@ Values compared with `equal'." position-cache (cdr buffer-cache) value-cache (when position-cache (gethash position position-cache)) - buffer-unmodified-p (eq (buffer-modified-tick) modified-tick)) + buffer-unmodified-p (eq (buffer-chars-modified-tick) modified-tick)) (unless (and buffer-cache buffer-unmodified-p) ;; Buffer-local node cache empty or invalid: make new one. (setf position-cache (make-hash-table) value-cache (gethash position position-cache)) (puthash (current-buffer) - (cons (buffer-modified-tick) position-cache) + (cons (buffer-chars-modified-tick) position-cache) org-ql-node-value-cache)) (setf (alist-get fn value-cache nil nil #'equal) new-value) (puthash position value-cache position-cache) diff --git a/org-ql.info b/org-ql.info index 25ccf74..3a4c3c0 100644 --- a/org-ql.info +++ b/org-ql.info @@ -1034,6 +1034,8 @@ File: README.info, Node: 07-pre, Next: 062, Up: Changelog *Internal* • Certain query predicates, when called multiple times in an ‘and’ sub-expression, are optimized to a single call. + • Use ‘buffer-chars-modified-tick’ instead of ‘buffer-modified-tick’. + (Thanks to Ihor Radchenko (https://github.com/yantar92).)  File: README.info, Node: 062, Next: 061, Prev: 07-pre, Up: Changelog @@ -1679,34 +1681,34 @@ Node: Links36761 Node: Tips37448 Node: Changelog37772 Node: 07-pre38540 -Node: 06239801 -Node: 06140109 -Node: 0640677 -Node: 05243731 -Node: 05144031 -Node: 0544454 -Node: 04945983 -Node: 04846263 -Node: 04746610 -Node: 04647019 -Node: 04547427 -Node: 04447788 -Node: 04348147 -Node: 04248350 -Node: 04148511 -Node: 0448758 -Node: 03252859 -Node: 03153262 -Node: 0353459 -Node: 02356759 -Node: 02256993 -Node: 02157273 -Node: 0257478 -Node: 0161556 -Node: Notes61657 -Node: Comparison with Org Agenda searches61819 -Node: org-sidebar62708 -Node: License62987 +Node: 06239947 +Node: 06140255 +Node: 0640823 +Node: 05243877 +Node: 05144177 +Node: 0544600 +Node: 04946129 +Node: 04846409 +Node: 04746756 +Node: 04647165 +Node: 04547573 +Node: 04447934 +Node: 04348293 +Node: 04248496 +Node: 04148657 +Node: 0448904 +Node: 03253005 +Node: 03153408 +Node: 0353605 +Node: 02356905 +Node: 02257139 +Node: 02157419 +Node: 0257624 +Node: 0161702 +Node: Notes61803 +Node: Comparison with Org Agenda searches61965 +Node: org-sidebar62854 +Node: License63133  End Tag Table