Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Agenda tags format. #441

Merged
merged 1 commit into from
Feb 27, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions README.org
Original file line number Diff line number Diff line change
Expand Up @@ -244,6 +244,14 @@ Deadline or Scheduling time will be formatted using
~dashboard-agenda-time-string-format~ and the keywords (TODO, DONE)
respect [[https://orgmode.org/worg/doc.html#org-agenda-todo-keyword-format][org-agenda-todo-keyword-format]].

*** Agenda tags

To customize the tags format there is a variable
~dashboard-agenda-tags-format~. This variable could be any function that
receives the tags directly from ~org-get-tags~. By default
~dashboard-agenda-tags-format~ is set to ~identity~. To hide the
tags set the variable to ~ignore~: ~(setq dashboard-agenda-tags-format 'ignore)~
or to ~nil~.

** Faces

Expand Down
16 changes: 15 additions & 1 deletion dashboard-widgets.el
Original file line number Diff line number Diff line change
Expand Up @@ -1155,6 +1155,15 @@ each agenda entry."
:type 'string
:group 'dashboard)

(defcustom dashboard-agenda-tags-format 'identity
"Function to format the org agenda tags.
Any custom function would receives the tags from `org-get-tags'"
:type '(choice
(const :tag "Show tags" identity)
(const :tag "Hide tags" ignore)
(function :tag "Custom function"))
:group 'dashboard)

(defun dashboard-agenda-entry-format ()
"Format agenda entry to show it on dashboard.
Also,it set text properties that latter are used to sort entries and perform different actions."
Expand All @@ -1167,7 +1176,7 @@ Also,it set text properties that latter are used to sort entries and perform dif
(dashboard-agenda--formatted-headline)
(org-outline-level)
(org-get-category)
(org-get-tags)))
(dashboard-agenda--formatted-tags)))
(todo-state (org-get-todo-state))
(item-priority (org-get-priority (org-get-heading t t t t)))
(todo-index (and todo-state
Expand Down Expand Up @@ -1207,6 +1216,11 @@ If not height is found on FACE or `dashboard-items-face' use `default'."
(dashboard-agenda--entry-timestamp (point)))))
(format-time-string dashboard-agenda-time-string-format time)))

(defun dashboard-agenda--formatted-tags ()
"Apply `dashboard-agenda-tags-format' to org-element tags."
(when dashboard-agenda-tags-format
(funcall dashboard-agenda-tags-format (org-get-tags))))

(defun dashboard-due-date-for-agenda ()
"Return due-date for agenda period."
(if dashboard-week-agenda
Expand Down