ENH use alist to keep track of life categories and such

This commit is contained in:
Nathan Dwarshuis 2021-12-30 18:06:23 -05:00
parent c709a01f18
commit f54f32c1df
2 changed files with 53 additions and 32 deletions

View File

@ -2396,14 +2396,14 @@ I use tags for agenda filtering (primarily for GTD contexts, see below). Each ta
;; life categories, used for gtd priorities
(:startgroup)
(,org-x-tag-environmental . ?E)
(,org-x-tag-financial . ?F)
(,org-x-tag-intellectual . ?I)
(,org-x-tag-metaphysical . ?M)
(,org-x-tag-physical . ?H)
(,org-x-tag-professional . ?P)
(,org-x-tag-recreational . ?R)
(,org-x-tag-social . ?S)
(,(org-x-life-category-tag 'env) . ?E)
(,(org-x-life-category-tag 'fin) . ?F)
(,(org-x-life-category-tag 'int) . ?I)
(,(org-x-life-category-tag 'met) . ?M)
(,(org-x-life-category-tag 'phy) . ?H)
(,(org-x-life-category-tag 'pro) . ?P)
(,(org-x-life-category-tag 'rec) . ?R)
(,(org-x-life-category-tag 'soc) . ?S)
(:endgroup)))
#+END_SRC
**** colors

View File

@ -133,37 +133,37 @@
(org-x-prepend-char org-x-tag-misc-prefix "meeting")
"Tag denoting a meeting.")
(defconst org-x-tag-environmental
(org-x-prepend-char org-x-tag-category-prefix "env")
"Tag denoting an environmental life category.")
;; (defconst org-x-tag-environmental
;; (org-x-prepend-char org-x-tag-category-prefix "env")
;; "Tag denoting an environmental life category.")
(defconst org-x-tag-financial
(org-x-prepend-char org-x-tag-category-prefix "fin")
"Tag denoting a financial life category.")
;; (defconst org-x-tag-financial
;; (org-x-prepend-char org-x-tag-category-prefix "fin")
;; "Tag denoting a financial life category.")
(defconst org-x-tag-intellectual
(org-x-prepend-char org-x-tag-category-prefix "int")
"Tag denoting an intellectual life category.")
;; (defconst org-x-tag-intellectual
;; (org-x-prepend-char org-x-tag-category-prefix "int")
;; "Tag denoting an intellectual life category.")
(defconst org-x-tag-metaphysical
(org-x-prepend-char org-x-tag-category-prefix "met")
"Tag denoting an metaphysical life category.")
;; (defconst org-x-tag-metaphysical
;; (org-x-prepend-char org-x-tag-category-prefix "met")
;; "Tag denoting an metaphysical life category.")
(defconst org-x-tag-physical
(org-x-prepend-char org-x-tag-category-prefix "phy")
"Tag denoting an physical life category.")
;; (defconst org-x-tag-physical
;; (org-x-prepend-char org-x-tag-category-prefix "phy")
;; "Tag denoting an physical life category.")
(defconst org-x-tag-professional
(org-x-prepend-char org-x-tag-category-prefix "pro")
"Tag denoting a professional life category.")
;; (defconst org-x-tag-professional
;; (org-x-prepend-char org-x-tag-category-prefix "pro")
;; "Tag denoting a professional life category.")
(defconst org-x-tag-recreational
(org-x-prepend-char org-x-tag-category-prefix "rec")
"Tag denoting a recreational life category.")
;; (defconst org-x-tag-recreational
;; (org-x-prepend-char org-x-tag-category-prefix "rec")
;; "Tag denoting a recreational life category.")
(defconst org-x-tag-social
(org-x-prepend-char org-x-tag-category-prefix "soc")
"Tag denoting a social life category.")
;; (defconst org-x-tag-social
;; (org-x-prepend-char org-x-tag-category-prefix "soc")
;; "Tag denoting a social life category.")
(defconst org-x-tag-no-agenda "NA"
"Tag denoting a headlines that shouldn't go in the agenda.")
@ -174,6 +174,27 @@
(defconst org-x-tag-refile "REFILE"
"Tag denoting a headlines that are to be refiled.")
(defconst org-x-life-categories
(->> (list "environmental"
"financial"
"intellectual"
"metaphysical"
"physical"
"professional"
"recreational"
"social")
(--map (let* ((abbr (substring it 0 3))
(key (intern abbr))
(tag (org-x-prepend-char org-x-tag-category-prefix abbr)))
(list key :tag tag :desc it))))
"Alist of life categories.
The car of each member is a symbol representing the category, the
cdr is a plist which has entries for :tag and :desc which are the
org tag and a long name respectively for the category.")
(defun org-x-life-category-tag (category-sym)
(plist-get (alist-get category-sym org-x-life-categories) :tag))
;;; PROPERTIES
;; all follow the nomenclature `org-x-prop-PROPNAME' (key) or