cashmere

cashmere

Org-QL

Description

Package to create cool and custom Org Agenda views.

Snippets

dashboard with different views

(use-package! org-ql
  :config
  (setq org-ql-views
        ;; First view
        '(("bachelor" lambda nil
            (interactive)
            (org-ql-search
              (org-agenda-files)
              '(and (todo) (tags "Bachelor"))
              :title "Bachelor TODOs"))

          ;; Second view
          ("master" lambda nil
            (interactive)
            (org-ql-search
              (org-agenda-files)
              '(and (todo) (tags "Master"))
              :title "Master TODOs"
              :sort '(priority)))  ;; Optional: Andere Sortierung

          ("projektX" lambda nil
            (interactive)
            (org-ql-search
              (org-agenda-files)
              '(and (todo)
                    (tags "ProjektX")
                    (not (tags "WAIT")))
              :title "ProjektX Active Tasks")))))

A very exhaustive configuration

;; (use-package! org-ql
;;   :config
;;   (setq
;;    org-ql-views
;;    '(("stuck" lambda nil
;;       (interactive)
;;       (org-ql-search
;;         (org-agenda-files)
;;         '(and (tags "story")
;;               (not (tags "ignore"))
;;               (not (done)) ;; Finished stories should be excluded
;;               (not (descendants (todo "NEXT"))) ;; If there are already
;;               ;; something in progress
;;               ;; it will shown
;;               (and (not (descendants (done))) ;; There are not scheduled not finished items
;;                    (not (descendants (scheduled)))))
;;         :narrow nil :super-groups
;;         '((:name "Waiting"   :order 8 :todo "WAIT")
;;           (:name "Important" :order 1 :deadline t :priority>= "B")
;;           (:name "Work"      :order 2 :tag "work")
;;           (:name "Study"     :order 2 :tag "study")
;;           (:name "Stucked"   :order 3 :tag "story"))
;;         :title "stuck-projects"))
;;      ("reports" lambda nil
;;       (interactive)
;;       (org-ql-search
;;         (org-agenda-files)
;;         '(and (or (tags-local "weekly")
;;                   (tags-local "monthly"))
;;               (not (tags "ignore")))
;;         :narrow nil :super-groups
;;         '((:name "Weekly reports" :tag "weekly")
;;           (:name "Monthly reports" :tag "monthly"))
;;         :title "Introspection reports"))
;;      ("next" lambda nil
;;       (interactive)
;;       (org-ql-search
;;         (org-agenda-files)
;;         '(and (or (tags-local "refile")
;;                   (todo "PROG")
;;                   (todo "WAIT")
;;                   (todo "NEXT"))
;;               (not (tags "ignore"))
;;               (not (property "linked"))
;;               (not (done)))
;;         :sort '(date)
;;         :narrow nil
;;         :super-groups
;;         `((:name "In progress" :order 1 :todo "PROG")
;;           (:name "Daily"       :order 2 :regexp ,org-repeat-re)
;;           (:name "Waiting"     :order 3 :todo "WAIT")
;;           (:name "Refile"      :order 3 :tag "refile")
;;           (:name "Important"   :order 3 :priority>= "B")
;;           (:auto-tags t        :order 5))
;;         :title "Next actions"))
;;      ("calendar" lambda nil
;;       (interactive)
;;       (org-ql-search
;;         (org-agenda-files)
;;         `(and (ts-active)
;;               (regexp ,org-scheduled-time-hour-regexp)
;;               (not (done)))
;;         :sort '(date)
;;         :narrow nil
;;         :super-groups
;;         '((:auto-planning t))
;;         :title "Calendar"))
;;      ("dashboard" lambda nil
;;       (interactive)
;;       (org-ql-search
;;         (org-agenda-files)
;;         '(and (or (ts-active :to today)
;;                   (deadline auto)
;;                   (todo "PROG")
;;                   (and (tags "journal")
;;                        (not (tags "weekly"))
;;                        (not (tags "monthly"))
;;                        (not (tags "yearly"))
;;                        (todo)))
;;               (not (todo "WAIT"))
;;               (not (tags "ignore"))
;;               (not (property "linked"))
;;               (not (done)))
;;         :sort '(date)
;;         :narrow nil
;;         :super-groups
;;         `((:name "In progress" :order 1
;;            :tag "monthly" :tag "weekly" :todo "PROG")
;;           (:name "Agenda"      :order 2
;;            :deadline t :regexp ,org-scheduled-time-hour-regexp)
;;           (:name "Daily"       :order 2
;;            :and (:todo nil :regexp ,org-repeat-re))
;;           (:name "Today"       :order 3 :tag "Tasks")
;;           (:name "Important"   :order 3 :priority>= "B")
;;           (:auto-tags t        :order 5))
;;         :title "Dashboard"))))
;;   )

Configuration

This is my current org-ql configuration to view the todo entries for my

Here is the configuration for org-ql defined:

(use-package! org-ql
  :config
  (setq org-ql-views
        '(("bachelor" lambda nil
            (interactive)
            (org-ql-search
              (org-agenda-files)
              '(and (todo) (tags "Bachelor"))
              :title "Bachelor TODOs")))))

Set a keymap

After that you can set a keymap. This keymap is to open org-ql as a sidebar

(map! :leader
      (:prefix ("o" . "org")
               (:prefix ("a" . "agenda")
                        (:prefix ("q" . "ql-view")
                         :desc "Org QL View Sidebar" "s" #'org-ql-view-sidebar))))