Add: (org-ql-view--format-element) org-category property

Hopefully this does not cause a noticeable performance impact.  Maybe
the new org-element caching features in Org will help with that.

Fixes #363.

Reported-by: Gabriele Mongiano <https://github.com/kofm>
This commit is contained in:
Adam Porter 2023-12-16 04:40:39 -06:00
parent ace5e361af
commit a31baebc4f
3 changed files with 50 additions and 35 deletions

View file

@ -561,6 +561,7 @@ Simple links may also be written manually in either sexp or non-sexp form, like:
+ Command ~org-ql-find~ may be called in an ~org-agenda~ or ~org-ql-view~ buffer to search the buffers which contributed to the agenda/view buffer.
+ Command ~org-ql-find-path~, which searches outline paths in the current buffer.
+ Command ~org-ql-open-link~, which finds links in entries matching the given query, and opens the selected one with ~org-open-at-point~. (This is helpful when a collection of links are kept in Org files: rather than having to first visit the entry containing the desired link, then locate it within the entry, and then open it, the user can simply select the link and open it directly.)
+ Items in ~org-ql-view~ buffers now include the ~org-category~ text property, like Org Agenda buffers, which allows grouping with ~org-super-agenda~'s category-related selectors. ([[https://github.com/alphapapa/org-ql/issues/363][#363]]. Thanks to [[https://github.com/kofm][Gabriele Mongiano]] for reporting.)
*Compatibility*

View file

@ -889,7 +889,15 @@ return an empty string."
(s-join ":" it)
(s-wrap it ":")
(org-add-props it nil 'face 'org-tag))))
;; (category (org-element-property :category element))
(category (or (org-element-property :CATEGORY element)
(when-let ((marker (or (org-element-property :org-hd-marker element)
(org-element-property :org-marker element))))
(org-with-point-at marker
(or (org-get-category)
(when buffer-file-name
(file-name-sans-extension
(file-name-nondirectory buffer-file-name))))))
""))
(priority-string (-some->> (org-element-property :priority element)
(char-to-string)
(format "[#%s]")
@ -909,6 +917,7 @@ return an empty string."
(concat " " it)
(org-add-props it properties
'org-agenda-type 'search
'org-category category
'todo-state todo-keyword
'tags tag-list
'org-habit-p habit-property)))))

View file

@ -1089,6 +1089,11 @@ File: README.info, Node: 08-pre, Next: 074, Up: Changelog
containing the desired link, then locate it within the entry, and
then open it, the user can simply select the link and open it
directly.)
• Items in org-ql-view buffers now include the org-category text
property, like Org Agenda buffers, which allows grouping with
org-super-agendas category-related selectors. (#363
(https://github.com/alphapapa/org-ql/issues/363). Thanks to
Gabriele Mongiano (https://github.com/kofm) for reporting.)
*Compatibility*
@ -1887,40 +1892,40 @@ Node: Links38785
Node: Tips39472
Node: Changelog39796
Node: 08-pre40620
Node: 07442385
Node: 07342612
Node: 07243344
Node: 07144263
Node: 0745072
Node: 06347996
Node: 06248527
Node: 06148832
Node: 0649400
Node: 05252456
Node: 05152758
Node: 0553183
Node: 04954714
Node: 04854996
Node: 04755345
Node: 04655754
Node: 04556162
Node: 04456523
Node: 04356882
Node: 04257085
Node: 04157246
Node: 0457493
Node: 03261594
Node: 03161997
Node: 0362194
Node: 02365494
Node: 02265728
Node: 02166008
Node: 0266213
Node: 0170291
Node: Notes70392
Node: Comparison with Org Agenda searches70554
Node: org-sidebar71443
Node: License71722
Node: 07442732
Node: 07342959
Node: 07243691
Node: 07144610
Node: 0745419
Node: 06348343
Node: 06248874
Node: 06149179
Node: 0649747
Node: 05252803
Node: 05153105
Node: 0553530
Node: 04955061
Node: 04855343
Node: 04755692
Node: 04656101
Node: 04556509
Node: 04456870
Node: 04357229
Node: 04257432
Node: 04157593
Node: 0457840
Node: 03261941
Node: 03162344
Node: 0362541
Node: 02365841
Node: 02266075
Node: 02166355
Node: 0266560
Node: 0170638
Node: Notes70739
Node: Comparison with Org Agenda searches70901
Node: org-sidebar71790
Node: License72069

End Tag Table