Create a more beautiful (and hopefully more helpful) agenda view

This commit is contained in:
Gergely Polonkai 2018-11-18 07:10:04 +01:00
parent 2053c10572
commit 9457b3a4c7

View File

@ -945,6 +945,43 @@ TODO: What is FIELD for?"
(or (abbrev--before-point) (yasnippet-can-fire-p)))
#+END_SRC
** Filter out tasks from the Org agenda if they have a specific priority
The whole idea comes from [[https://blog.aaronbieber.com/2016/09/24/an-agenda-for-life-with-org-mode.html][here]], which i use almost verbatim. This is also the reason it has the
~air-~ prefix.
#+BEGIN_SRC emacs-lisp
(defun air-org-skip-subtree-if-priority (priority)
"Skip an agenda subtree if it has a priority of PRIORITY.
PRIORITY may be one of the characters ?A, ?B, or ?C."
(let ((subtree-end (save-excursion (org-end-of-subtree t)))
(pri-value (* 1000 (- org-lowest-priority priority)))
(pri-current (org-get-priority (thing-at-point 'line t))))
(if (= pri-value pri-current)
subtree-end
nil)))
#+END_SRC
** Filter out habits from the Org agenda
#+BEGIN_SRC emacs-lisp
(defun air-org-skip-subtree-if-habit ()
"Skip an agenda entry if it has a STYLE property equal to \"habit\"."
(let ((subtree-end (save-excursion (org-end-of-subtree t))))
(if (string= (org-entry-get nil "STYLE") "habit")
subtree-end
nil)))
#+END_SRC
** Wrapper around ~org-agenda~ to open my own custom list
#+BEGIN_SRC emacs-lisp
(defun gpolonkai/org-agenda-list (&optional arg)
(interactive "P")
(org-agenda arg "c"))
#+END_SRC
* UI preferences
** Tweak window chrome
@ -2428,7 +2465,18 @@ This is a big one; I use a lot of customisation here.
org-refile-targets '((org-agenda-files :maxlevel . 3))
org-refile-use-outline-path 'file
org-outline-path-complete-in-steps nil
org-refile-allow-creating-parent-nodes 'confirm)
org-refile-allow-creating-parent-nodes 'confirm
org-agenda-custom-commands '(("c" "Simple agenda view" ((tags "PRIORITY=\"A\""
((org-agenda-skip-function '(org-agenda-skip-entry-if 'todo 'done))
(org-agenda-overriding-header "High priority unfinished tasks")))
(agenda "")
(alltodo ""
((org-agenda-skip-function
'(or (air-org-skip-subtree-if-habit)
(air-org-skip-subtree-if-priority ?A)
(org-agenda-skip-if nil '(scheduled deadline))))
(org-agenda-overriding-header "ALL normal priority tasks"))))
((org-agenda-compact-blocks t)))))
:config
;; Load the markdown exporter
(require 'ox-md)
@ -2450,7 +2498,7 @@ This is a big one; I use a lot of customisation here.
(add-hook 'ediff-unselect-hook 'f-ediff-org-fold-tree)
:bind
(:map gpolonkai/pers-map
("a" . org-agenda-list)
("a" . gpolonkai/org-agenda-list)
("c" . org-capture)
("l" . org-store-link)
:map org-mode-map