Change/Fix: (org-ql-view--format-element) Use org-ql--tags-at

Use org-ql--tags-at instead of org-get-tags/org-get-tags-at.  This
uses our cache, which should improve performance, and it obviates the
function alias for Org versions before 9.3 (which occasionally
misbehaves, e.g. if Org is reloaded).
This commit is contained in:
Adam Porter 2020-11-08 18:05:27 -06:00
parent 958cd50794
commit 359a280d11
3 changed files with 34 additions and 32 deletions

View file

@ -418,6 +418,9 @@ Expands into a call to ~org-ql-select~ with the same arguments. For convenience
*Changed* *Changed*
+ Binding to refresh search/view buffers changed to =r=. + Binding to refresh search/view buffers changed to =r=.
*Internal*
+ When formatting entries for Org QL View buffers, use internal function for retrieving heading tags. This improves speed by using our cache, and it removes the need for a compatibility alias for Org versions before 9.3.
** 0.4.6 ** 0.4.6
*Fixed* *Fixed*

View file

@ -47,11 +47,6 @@
(require 'ov) (require 'ov)
(require 'ts) (require 'ts)
;;;; Compatibility
(when (version< org-version "9.2")
(defalias 'org-get-tags #'org-get-tags-at))
;;;; Faces ;;;; Faces
(defface org-ql-view-due-date (defface org-ql-view-due-date
@ -729,18 +724,16 @@ return an empty string."
(org-link-display-format it))) (org-link-display-format it)))
(todo-keyword (-some--> (org-element-property :todo-keyword element) (todo-keyword (-some--> (org-element-property :todo-keyword element)
(org-ql-view--add-todo-face it))) (org-ql-view--add-todo-face it)))
;; FIXME: Figure out whether I should use `org-agenda-use-tag-inheritance' or `org-use-tag-inheritance', etc.
(tag-list (if org-use-tag-inheritance (tag-list (if org-use-tag-inheritance
;; FIXME: Note that tag inheritance cannot be used here unless markers are ;; MAYBE: Use our own variable instead of `org-use-tag-inheritance'.
;; added, otherwise we can't go to the item's buffer to look for inherited
;; tags. (Or does `org-element-headline-parser' parse inherited tags too? I
;; forget...)
(if-let ((marker (or (org-element-property :org-hd-marker element) (if-let ((marker (or (org-element-property :org-hd-marker element)
(org-element-property :org-marker element)))) (org-element-property :org-marker element))))
(with-current-buffer (marker-buffer marker) (cl-loop for type in (org-ql--tags-at marker)
;; I wish `org-get-tags' used the correct buffer automatically. unless (or (eq 'org-ql-nil type)
(org-get-tags marker (not org-use-tag-inheritance))) (not type))
append type)
;; No marker found ;; No marker found
;; TODO: Use `display-warning' with `org-ql' as the type.
(warn "No marker found for item: %s" title) (warn "No marker found for item: %s" title)
(org-element-property :tags element)) (org-element-property :tags element))
(org-element-property :tags element))) (org-element-property :tags element)))

View file

@ -772,6 +772,12 @@ File: README.info, Node: 05-pre, Next: 046, Up: Changelog
*Changed* *Changed*
• Binding to refresh search/view buffers changed to r. • Binding to refresh search/view buffers changed to r.
*Internal*
• When formatting entries for Org QL View buffers, use internal
function for retrieving heading tags. This improves speed by using
our cache, and it removes the need for a compatibility alias for
Org versions before 9.3.
 
File: README.info, Node: 046, Next: 045, Prev: 05-pre, Up: Changelog File: README.info, Node: 046, Next: 045, Prev: 05-pre, Up: Changelog
@ -1205,25 +1211,25 @@ Node: Listing / acting-on results21208
Node: Tips25810 Node: Tips25810
Node: Changelog26141 Node: Changelog26141
Node: 05-pre26780 Node: 05-pre26780
Node: 04627369 Node: 04627626
Node: 04527772 Node: 04528029
Node: 04428131 Node: 04428388
Node: 04328488 Node: 04328745
Node: 04228683 Node: 04228940
Node: 04128842 Node: 04129099
Node: 0429081 Node: 0429338
Node: 03233012 Node: 03233269
Node: 03133389 Node: 03133646
Node: 0333586 Node: 0333843
Node: 02336561 Node: 02336818
Node: 02236789 Node: 02237046
Node: 02137057 Node: 02137314
Node: 0237256 Node: 0237513
Node: 0141291 Node: 0141548
Node: Notes41392 Node: Notes41649
Node: Comparison with Org Agenda searches41554 Node: Comparison with Org Agenda searches41811
Node: org-sidebar42426 Node: org-sidebar42683
Node: License42705 Node: License42962
 
End Tag Table End Tag Table