Skip to content

Latest commit

 

History

History
64 lines (49 loc) · 2.48 KB

examples.org

File metadata and controls

64 lines (49 loc) · 2.48 KB

Examples

Custom sidebar command

It’s easy to define a custom sidebar command. Here’s an example that shows items in org-agenda-files that are not done and either have a deadline on or before today, or are scheduled for today. The query ((and ...) uses org-ql to select items.

(defun my/org-sidebar ()
  "Display my Org Sidebar."
  (interactive)
  (org-sidebar
   :sidebars (make-org-sidebar
              :name "My Sidebar"
              :description "My sidebar items"
              :items (org-ql (org-agenda-files)
                       (and (not (done))
                            (or (deadline auto)
                                (scheduled :on today)))
                       :action element-with-markers))))

Grouping with org-super-agenda

org-sidebar also integrates with org-super-agenda. This command is like the previous one, but it groups items with org-super-agenda into several groups.

(defun my/org-today-sidebar ()
  "Show my Org Today Sidebar."
  (interactive)
  (org-sidebar
   :sidebars (make-org-sidebar
              :name "Today"
              :description "Today items"
              :items (org-ql (org-agenda-files)
                       (and (not (done))
                            (or (deadline auto)
                                (scheduled :to today)))
                       :action element-with-markers)
              :super-groups '((:time-grid t)
                              (:name "Overdue" :scheduled past :deadline past)
                              (:name "Due today" :scheduled today :deadline today)
                              (:tag "bills")
                              (:priority "A")
                              (:name "Non-tasks"
                                     :todo nil)))))

This shows a sidebar like this:

images/custom-command.png