Reorganize Org mode custom functions for better readability

This commit is contained in:
Gergely Polonkai 2021-03-18 06:09:06 +01:00
parent c62c1ac457
commit ebc2d58aa7
No known key found for this signature in database
GPG Key ID: 2D2885533B869ED4

View File

@ -1040,12 +1040,14 @@ 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
** Org mode stuff
*** 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
#+begin_src emacs-lisp
(defun air-org-skip-subtree-if-priority (priority)
"Skip an agenda subtree if it has a priority of PRIORITY.
@ -1056,37 +1058,37 @@ PRIORITY may be one of the characters ?A, ?B, or ?C."
(if (= pri-value pri-current)
subtree-end
nil)))
#+END_SRC
#+end_src
** Filter out habits from the Org agenda
*** Filter out habits from the Org agenda
#+BEGIN_SRC emacs-lisp
#+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
#+end_src
** Filter out entries from the Org agenda with a specific state
*** Filter out entries from the Org agenda with a specific state
#+BEGIN_SRC emacs-lisp
#+begin_src emacs-lisp
(defun gpolonkai/org-skip-subtree-if-state (state)
"Skip an agenda entry if its state is STATE."
(let ((subtree-end (save-excursion (org-end-of-subtree t))))
(if (string= (org-get-todo-state) state)
subtree-end
nil)))
#+END_SRC
#+end_src
** Wrapper around ~org-agenda~ to open my own custom list
*** Wrapper around ~org-agenda~ to open my own custom list
#+BEGIN_SRC emacs-lisp
#+begin_src emacs-lisp
(defun gpolonkai/org-agenda-list (&optional arg)
(interactive "P")
(org-agenda arg "c"))
#+END_SRC
#+end_src
* UI preferences