Pass category to the formatter

This commit is contained in:
Akira Komamura 2019-09-07 00:29:06 +09:00
parent 2644648793
commit 6ce24ada7e

View file

@ -490,6 +490,8 @@ return an empty string."
for symbol = (intern (cl-subseq (symbol-name key) 1)) for symbol = (intern (cl-subseq (symbol-name key) 1))
unless (member symbol '(parent)) unless (member symbol '(parent))
append (list symbol val))) append (list symbol val)))
(marker (or (org-element-property :org-hd-marker element)
(org-element-property :org-marker element)))
;; TODO: --add-faces is used to add the :relative-due-date property, but that fact is ;; TODO: --add-faces is used to add the :relative-due-date property, but that fact is
;; hidden by doing it through --add-faces (which calls --add-scheduled-face and ;; hidden by doing it through --add-faces (which calls --add-scheduled-face and
;; --add-deadline-face), and doing it in this form that gets the title hides it even more. ;; --add-deadline-face), and doing it in this form that gets the title hides it even more.
@ -505,8 +507,7 @@ return an empty string."
;; NOTE: Tag inheritance cannot be used here unless markers are added, otherwise ;; NOTE: 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 ;; 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...) ;; `org-element-headline-parser' parse inherited tags too? I forget...)
(if-let ((marker (or (org-element-property :org-hd-marker element) (if marker
(org-element-property :org-marker element))))
(with-current-buffer (marker-buffer marker) (with-current-buffer (marker-buffer marker)
;; I wish `org-get-tags' used the correct buffer automatically. ;; I wish `org-get-tags' used the correct buffer automatically.
(org-get-tags marker (not org-use-tag-inheritance))) (org-get-tags marker (not org-use-tag-inheritance)))
@ -520,7 +521,6 @@ return an empty string."
(s-join ":" it) (s-join ":" it)
(s-wrap it ":") (s-wrap it ":")
(org-add-props it nil 'face 'org-tag)))) (org-add-props it nil 'face 'org-tag))))
;; (category (org-element-property :category element))
(priority-string (-some->> (org-element-property :priority element) (priority-string (-some->> (org-element-property :priority element)
(char-to-string) (char-to-string)
(format "[#%s]") (format "[#%s]")
@ -531,12 +531,16 @@ return an empty string."
(due-string (pcase (org-element-property :relative-due-date element) (due-string (pcase (org-element-property :relative-due-date element)
('nil "") ('nil "")
(string (format " %s " (org-add-props string nil 'face 'org-ql-agenda-due-date))))) (string (format " %s " (org-add-props string nil 'face 'org-ql-agenda-due-date)))))
(category (when marker
(with-current-buffer (marker-buffer marker)
(org-get-category marker))))
(string (funcall org-ql-agenda-format-function (string (funcall org-ql-agenda-format-function
`((todo . ,todo-keyword) `((todo . ,todo-keyword)
(priority . ,priority-string) (priority . ,priority-string)
(title . ,title) (title . ,title)
(due . ,due-string) (due . ,due-string)
(tags . ,tag-string)) (tags . ,tag-string)
(category . ,category))
element))) element)))
(remove-list-of-text-properties 0 (length string) '(line-prefix) string) (remove-list-of-text-properties 0 (length string) '(line-prefix) string)
;; Add all the necessary properties and faces to the whole string ;; Add all the necessary properties and faces to the whole string