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

Added filtering by category for org mode #167

Merged
merged 3 commits into from
Jul 2, 2019
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 6 additions & 0 deletions README.org
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,12 @@ To show agenda for the upcoming seven days set the variable ~show-week-agenda-p~

Note that setting list-size for the agenda list is intentionally ignored; all agenda items for the current day will be displayed.

To customize which categories from the agenda items should be visible in the dashboard set the ~dashboard-org-agenda-categories~ to the list of categories you need.

#+BEGIN_SRC elisp
(setq dashboard-org-agenda-categories '("Tasks" "Appointments"))
#+END_SRC

** Faces

It is possible to customize Dashboard's appearance using the following faces:
Expand Down
21 changes: 15 additions & 6 deletions dashboard-widgets.el
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,13 @@ to the specified width, with aspect ratio preserved."
:type 'boolean
:group 'dashboard)

(defcustom dashboard-org-agenda-categories nil
"Specify the Categories to consider when using agenda in dashboard.
Example:
'(\"Tasks\" \"Habits\")"
:type 'list
:group 'dashboard)

(defconst dashboard-banners-directory
(concat (file-name-directory
(locate-library "dashboard"))
Expand Down Expand Up @@ -606,12 +613,14 @@ date part is considered."
t))
(loc (point))
(file (buffer-file-name)))
(when (and (not (org-entry-is-done-p))
(or (and schedule-time (dashboard-date-due-p schedule-time due-date))
(and deadline-time (dashboard-date-due-p deadline-time due-date))))
(setq filtered-entries
(append filtered-entries
(list (list item schedule-time deadline-time loc file)))))))
(if (or (equal dashboard-org-agenda-categories nil)
(member (org-get-category) dashboard-org-agenda-categories))
(when (and (not (org-entry-is-done-p))
(or (and schedule-time (dashboard-date-due-p schedule-time due-date))
(and deadline-time (dashboard-date-due-p deadline-time due-date))))
(setq filtered-entries
(append filtered-entries
(list (list item schedule-time deadline-time loc file))))))))
nil
'agenda)
filtered-entries)))
Expand Down