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*
+ 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
*Fixed*

View file

@ -47,11 +47,6 @@
(require 'ov)
(require 'ts)
;;;; Compatibility
(when (version< org-version "9.2")
(defalias 'org-get-tags #'org-get-tags-at))
;;;; Faces
(defface org-ql-view-due-date
@ -729,18 +724,16 @@ return an empty string."
(org-link-display-format it)))
(todo-keyword (-some--> (org-element-property :todo-keyword element)
(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
;; FIXME: Note that tag inheritance cannot be used here unless markers are
;; 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...)
;; MAYBE: Use our own variable instead of `org-use-tag-inheritance'.
(if-let ((marker (or (org-element-property :org-hd-marker element)
(org-element-property :org-marker element))))
(with-current-buffer (marker-buffer marker)
;; I wish `org-get-tags' used the correct buffer automatically.
(org-get-tags marker (not org-use-tag-inheritance)))
(cl-loop for type in (org-ql--tags-at marker)
unless (or (eq 'org-ql-nil type)
(not type))
append type)
;; No marker found
;; TODO: Use `display-warning' with `org-ql' as the type.
(warn "No marker found for item: %s" title)
(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*
• 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
@ -1205,25 +1211,25 @@ Node: Listing / acting-on results21208
Node: Tips25810
Node: Changelog26141
Node: 05-pre26780
Node: 04627369
Node: 04527772
Node: 04428131
Node: 04328488
Node: 04228683
Node: 04128842
Node: 0429081
Node: 03233012
Node: 03133389
Node: 0333586
Node: 02336561
Node: 02236789
Node: 02137057
Node: 0237256
Node: 0141291
Node: Notes41392
Node: Comparison with Org Agenda searches41554
Node: org-sidebar42426
Node: License42705
Node: 04627626
Node: 04528029
Node: 04428388
Node: 04328745
Node: 04228940
Node: 04129099
Node: 0429338
Node: 03233269
Node: 03133646
Node: 0333843
Node: 02336818
Node: 02237046
Node: 02137314
Node: 0237513
Node: 0141548
Node: Notes41649
Node: Comparison with Org Agenda searches41811
Node: org-sidebar42683
Node: License42962

End Tag Table