Commit 12b7e7be authored by Victor A. Stoichiţă's avatar Victor A. Stoichiţă
Browse files

[org] simplify gtd projects housekeeping

Don’t rely on Petton’s function to skip all siblings but first in
projects. Not flexible enough for on-the-fly searches. Also problematic
for notes agenda sets. Instead rely more on on-the-fly searches.
parent 4674ca90
......@@ -119,30 +119,18 @@
(search . " %i %-12:c")))
(setq org-agenda-remove-tags-when-in-prefix 'prefix)
(defun vic/org-gtd-files ()
"List files for Getting Things Done workflow.
Used as org-agenda-files and as org-refile-targets"
(let ((gtd-dir "~/org/")
(gtd-files '("in.org"
"unjour.org"
"encours.org"
"tickler.org")))
(mapcar
(lambda (x)
(concat vic/org-gtd-directory x)) gtd-files)))
(defun vic/org-current-is-todo-no-timestamp ()
(string= "FAIRE" (org-get-todo-state)))
(defun vic/org-agenda-skip-all-siblings-but-first ()
(defun vic/org-agenda-skip-gtd-style (types)
"Skip all but the first non-done entry.
From Nicolas Petton https://emacs.cafe/emacs/orgmode/gtd/2017/06/30/orgmode-gtd.html"
(let (should-skip-entry)
(unless (vic/org-current-is-todo-no-timestamp)
(setq should-skip-entry t))
Idea from Nicolas Petton https://emacs.cafe/emacs/orgmode/gtd/2017/06/30/orgmode-gtd.html
TYPES is a list of todo states to check and maybe skip."
(let ((should-skip-entry (unless
(and
(org-get-todo-state) ;; skip if not todo
(not (equal (nth 0 (org-get-tags)) "unjour")) ;; skip if tagged "unjour" (file tag)
t))))
(save-excursion
(while (and (not should-skip-entry) (org-goto-sibling t))
(when (vic/org-current-is-todo-no-timestamp)
(when (member (org-get-todo-state) types)
(setq should-skip-entry t))))
(when should-skip-entry
(or (outline-next-heading)
......@@ -153,31 +141,39 @@
((org-agenda-files '("~/calendriers"))
;; ensures that repeating events appear on all relevant dates
(org-agenda-repeating-timestamp-show-all t)))
("f" "Agenda avec todo" ; block agenda
("V" "Calendar view" cfw:open-org-calendar
((org-agenda-files "~/calendriers")))
("d" "Agenda & todo global" ; block agenda
((agenda ""
((org-agenda-span 1)
(org-agenda-skip-function '(org-agenda-skip-entry-if 'todo '("RÉPONDRE")))))
(tags-todo "+mail +tel"
((org-agenda-prefix-format '((tags . "%i %?-12t%b")))
(org-agenda-overriding-header "Mails et tel")))
(tags-todo "-mail -tel"
((org-agenda-prefix-format '((tags . "%i %?-12t%b")))
(org-agenda-overriding-header "Projets en cours")))))
("l" "Agenda & todo @anthro" ; block agenda
((agenda ""
((org-agenda-span 1)
(org-agenda-files '("~/calendriers" "~/org/encours.org" "~/org/tickler.org"))))
(todo "FAIRE"
((org-agenda-files '("~/org/encours.org"))
(org-agenda-skip-function 'vic/org-agenda-skip-all-siblings-but-first)
(org-agenda-prefix-format '((todo . " %i %?-12t%(vic/org-get-parent-title-at-level 2 \": \")")))
(org-agenda-overriding-header "Projets")))))
("l" "Calendar view" cfw:open-org-calendar
((org-agenda-files "~/calendriers/agendaList-calendriers.org")))))
(defun vic/org-get-parent-title-at-level (level &optional separator)
"Get title of parent heading at LEVEL. Append optional SEPARATOR string.
Returns empty string of no heading at LEVEL."
(let ((titles (org-get-outline-path))
(separator (or separator nil)))
(if (<= level (length titles))
(concat (nth (- level 1) titles) separator)
"")))
(org-agenda-skip-function '(org-agenda-skip-entry-if 'todo '("RÉPONDRE")))))
(tags-todo "@anthro+mail|@anthro+tel "
((org-agenda-prefix-format '((tags . "%i %?-12t%b")))
(org-agenda-overriding-header "Mails et tel")))
(tags-todo "@anthro-mail|@anthro-tel"
((org-agenda-prefix-format '((tags . "%i %?-12t%b")))
(org-agenda-overriding-header "Anthro en cours")))))))
;;; TODO:
(setq org-todo-keywords
'((sequence "FAIRE(t)" "ATTENTE(a)" "|" "FAIT(d)" "ABANDON(c)")
(sequence "TODO" "WAITING(w)" "|" "DONE" "CANCELLED")))
'((sequence "TODO(t)" "ATTENTE(a)" "RÉPONDRE(r)" "|" "DONE(d)" "ABANDON(c)")
(sequente "LIRE(l)" "NOTES(n)" "|" "LU(u)")))
(setq org-todo-keyword-faces
'(("LIRE" . org-sexp-date)
("NOTES" . org-sexp-date)
("RÉPONDRE" . compilation-warning)))
(setq org-tag-faces
'(("lire" . org-sexp-date)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment