aboutsummaryrefslogtreecommitdiff
path: root/.emacs.d
diff options
context:
space:
mode:
Diffstat (limited to '.emacs.d')
-rw-r--r--.emacs.d/rul-lisp/packages/rul-org-agenda.el284
-rw-r--r--.emacs.d/rul-lisp/packages/rul-org.el4
2 files changed, 0 insertions, 288 deletions
diff --git a/.emacs.d/rul-lisp/packages/rul-org-agenda.el b/.emacs.d/rul-lisp/packages/rul-org-agenda.el
index 9d249f9..044b164 100644
--- a/.emacs.d/rul-lisp/packages/rul-org-agenda.el
+++ b/.emacs.d/rul-lisp/packages/rul-org-agenda.el
@@ -11,262 +11,6 @@
(with-eval-after-load 'org-agenda
(advice-add 'org-agenda-todo :after #'rul-org-agenda-save-after-todo))
-(defun bh/is-project-p ()
- "Any task with a todo keyword subtask"
- (save-restriction
- (widen)
- (let ((has-subtask)
- (subtree-end (save-excursion (org-end-of-subtree t)))
- (is-a-task (member (nth 2 (org-heading-components)) org-todo-keywords-1)))
- (save-excursion
- (forward-line 1)
- (while (and (not has-subtask)
- (< (point) subtree-end)
- (re-search-forward "^\*+ " subtree-end t))
- (when (member (org-get-todo-state) org-todo-keywords-1)
- (setq has-subtask t))))
- (and is-a-task has-subtask))))
-
-(defun bh/is-project-subtree-p ()
- "Any task with a todo keyword that is in a project subtree.
-Callers of this function already widen the buffer view."
- (let ((task (save-excursion (org-back-to-heading 'invisible-ok)
- (point))))
- (save-excursion
- (bh/find-project-task)
- (if (equal (point) task)
- nil
- t))))
-
-(defun bh/is-task-p ()
- "Any task with a todo keyword and no subtask"
- (save-restriction
- (widen)
- (let ((has-subtask)
- (subtree-end (save-excursion (org-end-of-subtree t)))
- (is-a-task (member (nth 2 (org-heading-components)) org-todo-keywords-1)))
- (save-excursion
- (forward-line 1)
- (while (and (not has-subtask)
- (< (point) subtree-end)
- (re-search-forward "^\*+ " subtree-end t))
- (when (member (org-get-todo-state) org-todo-keywords-1)
- (setq has-subtask t))))
- (and is-a-task (not has-subtask)))))
-
-(defun bh/is-subproject-p ()
- "Any task which is a subtask of another project"
- (let ((is-subproject)
- (is-a-task (member (nth 2 (org-heading-components)) org-todo-keywords-1)))
- (save-excursion
- (while (and (not is-subproject) (org-up-heading-safe))
- (when (member (nth 2 (org-heading-components)) org-todo-keywords-1)
- (setq is-subproject t))))
- (and is-a-task is-subproject)))
-
-(defun bh/list-sublevels-for-projects-indented ()
- "Set org-tags-match-list-sublevels so when restricted to a subtree we list all subtasks.
- This is normally used by skipping functions where this variable is already local to the agenda."
- (if (marker-buffer org-agenda-restrict-begin)
- (setq org-tags-match-list-sublevels 'indented)
- (setq org-tags-match-list-sublevels nil))
- nil)
-
-(defun bh/list-sublevels-for-projects ()
- "Set org-tags-match-list-sublevels so when restricted to a subtree we list all subtasks.
- This is normally used by skipping functions where this variable is already local to the agenda."
- (if (marker-buffer org-agenda-restrict-begin)
- (setq org-tags-match-list-sublevels t)
- (setq org-tags-match-list-sublevels nil))
- nil)
-
-(defvar bh/hide-scheduled-and-waiting-next-tasks t)
-
-(defun bh/toggle-next-task-display ()
- (interactive)
- (setq bh/hide-scheduled-and-waiting-next-tasks (not bh/hide-scheduled-and-waiting-next-tasks))
- (when (equal major-mode 'org-agenda-mode)
- (org-agenda-redo))
- (message "%s WAITING and SCHEDULED NEXT Tasks" (if bh/hide-scheduled-and-waiting-next-tasks "Hide" "Show")))
-
-(defun bh/skip-stuck-projects ()
- "Skip trees that are not stuck projects"
- (save-restriction
- (widen)
- (let ((next-headline (save-excursion (or (outline-next-heading) (point-max)))))
- (if (bh/is-project-p)
- (let* ((subtree-end (save-excursion (org-end-of-subtree t)))
- (has-next ))
- (save-excursion
- (forward-line 1)
- (while (and (not has-next) (< (point) subtree-end) (re-search-forward "^\\*+ NEXT " subtree-end t))
- (unless (member "WAITING" (org-get-tags-at))
- (setq has-next t))))
- (if has-next
- nil
- next-headline)) ; a stuck project, has subtasks but no next task
- nil))))
-
-(defun bh/skip-non-stuck-projects ()
- "Skip trees that are not stuck projects"
- ;; (bh/list-sublevels-for-projects-indented)
- (save-restriction
- (widen)
- (let ((next-headline (save-excursion (or (outline-next-heading) (point-max)))))
- (if (bh/is-project-p)
- (let* ((subtree-end (save-excursion (org-end-of-subtree t)))
- (has-next ))
- (save-excursion
- (forward-line 1)
- (while (and (not has-next) (< (point) subtree-end) (re-search-forward "^\\*+ NEXT " subtree-end t))
- (unless (member "WAITING" (org-get-tags-at))
- (setq has-next t))))
- (if has-next
- next-headline
- nil)) ; a stuck project, has subtasks but no next task
- next-headline))))
-
-(defun bh/skip-non-projects ()
- "Skip trees that are not projects"
- ;; (bh/list-sublevels-for-projects-indented)
- (if (save-excursion (bh/skip-non-stuck-projects))
- (save-restriction
- (widen)
- (let ((subtree-end (save-excursion (org-end-of-subtree t))))
- (cond
- ((bh/is-project-p)
- nil)
- ((and (bh/is-project-subtree-p) (not (bh/is-task-p)))
- nil)
- (t
- subtree-end))))
- (save-excursion (org-end-of-subtree t))))
-
-(defun bh/skip-non-tasks ()
- "Show non-project tasks.
-Skip project and sub-project tasks, habits, and project related tasks."
- (save-restriction
- (widen)
- (let ((next-headline (save-excursion (or (outline-next-heading) (point-max)))))
- (cond
- ((bh/is-task-p)
- nil)
- (t
- next-headline)))))
-
-(defun bh/skip-project-trees-and-habits ()
- "Skip trees that are projects"
- (save-restriction
- (widen)
- (let ((subtree-end (save-excursion (org-end-of-subtree t))))
- (cond
- ((bh/is-project-p)
- subtree-end)
- ((org-is-habit-p)
- subtree-end)
- (t
- nil)))))
-
-(defun bh/skip-projects-and-habits-and-single-tasks ()
- "Skip trees that are projects, tasks that are habits, single non-project tasks"
- (save-restriction
- (widen)
- (let ((next-headline (save-excursion (or (outline-next-heading) (point-max)))))
- (cond
- ((org-is-habit-p)
- next-headline)
- ((and bh/hide-scheduled-and-waiting-next-tasks
- (member "WAITING" (org-get-tags-at)))
- next-headline)
- ((bh/is-project-p)
- next-headline)
- ((and (bh/is-task-p) (not (bh/is-project-subtree-p)))
- next-headline)
- (t
- nil)))))
-
-(defun bh/skip-project-tasks-maybe ()
- "Show tasks related to the current restriction.
-When restricted to a project, skip project and sub project tasks, habits, NEXT tasks, and loose tasks.
-When not restricted, skip project and sub-project tasks, habits, and project related tasks."
- (save-restriction
- (widen)
- (let* ((subtree-end (save-excursion (org-end-of-subtree t)))
- (next-headline (save-excursion (or (outline-next-heading) (point-max))))
- (limit-to-project (marker-buffer org-agenda-restrict-begin)))
- (cond
- ((bh/is-project-p)
- next-headline)
- ((org-is-habit-p)
- subtree-end)
- ((and (not limit-to-project)
- (bh/is-project-subtree-p))
- subtree-end)
- ((and limit-to-project
- (bh/is-project-subtree-p)
- (member (org-get-todo-state) (list "NEXT")))
- subtree-end)
- (t
- nil)))))
-
-(defun bh/skip-project-tasks ()
- "Show non-project tasks.
-Skip project and sub-project tasks, habits, and project related tasks."
- (save-restriction
- (widen)
- (let* ((subtree-end (save-excursion (org-end-of-subtree t))))
- (cond
- ((bh/is-project-p)
- subtree-end)
- ((org-is-habit-p)
- subtree-end)
- ((bh/is-project-subtree-p)
- subtree-end)
- ((not (org-entry-is-todo-p))
- subtree-end)
- (t
- nil)))))
-
-(defun bh/skip-non-project-tasks ()
- "Show project tasks.
-Skip project and sub-project tasks, habits, and loose non-project tasks."
- (save-restriction
- (widen)
- (let* ((subtree-end (save-excursion (org-end-of-subtree t)))
- (next-headline (save-excursion (or (outline-next-heading) (point-max)))))
- (cond
- ((bh/is-project-p)
- next-headline)
- ((org-is-habit-p)
- subtree-end)
- ((and (bh/is-project-subtree-p)
- (member (org-get-todo-state) (list "NEXT")))
- subtree-end)
- ((not (bh/is-project-subtree-p))
- subtree-end)
- (t
- nil)))))
-
-(defun bh/skip-projects-and-habits ()
- "Skip trees that are projects and tasks that are habits"
- (save-restriction
- (widen)
- (let ((subtree-end (save-excursion (org-end-of-subtree t))))
- (cond
- ((bh/is-project-p)
- subtree-end)
- ((org-is-habit-p)
- subtree-end)
- (t
- nil)))))
-
-(defun bh/skip-non-subprojects ()
- "Skip trees that are not projects"
- (let ((next-headline (save-excursion (outline-next-heading))))
- (if (bh/is-subproject-p)
- nil
- next-headline)))
-
;; CLOCKING ;;
;; Resume clocking task when emacs is restarted
(org-clock-persistence-insinuate)
@@ -292,34 +36,6 @@ Skip project and sub-project tasks, habits, and loose non-project tasks."
;; Include current clocking task in clock reports
(setq org-clock-report-include-clocking-task t)
-(defun bh/find-project-task ()
- "Move point to the parent (project) task if any"
- (save-restriction
- (widen)
- (let ((parent-task (save-excursion (org-back-to-heading 'invisible-ok) (point))))
- (while (org-up-heading-safe)
- (when (member (nth 2 (org-heading-components)) org-todo-keywords-1)
- (setq parent-task (point))))
- (goto-char parent-task)
- parent-task)))
-
-;; https://stackoverflow.com/a/10091330
-(defun zin/org-agenda-skip-tag (tag &optional others)
- "Skip all entries that correspond to TAG.
-
-If OTHERS is true, skip all entries that do not correspond to TAG."
- (let ((next-headline (save-excursion (or (outline-next-heading) (point-max))))
- (current-headline (or (and (org-at-heading-p)
- (point))
- (save-excursion (org-back-to-heading)))))
- (if others
- (if (not (member tag (org-get-tags-at current-headline)))
- next-headline
- nil)
- (if (member tag (org-get-tags-at current-headline))
- next-headline
- nil))))
-
;; AGENDA VIEW ;;
;; Do not dim blocked tasks
diff --git a/.emacs.d/rul-lisp/packages/rul-org.el b/.emacs.d/rul-lisp/packages/rul-org.el
index 02688fd..2705aa5 100644
--- a/.emacs.d/rul-lisp/packages/rul-org.el
+++ b/.emacs.d/rul-lisp/packages/rul-org.el
@@ -167,10 +167,6 @@
("CANCELLED" . ?c)
("FLAGGED" . ??))))
-(setq org-stuck-projects
- '("+LEVEL=2+PROJECT/-MAYBE-DONE" ("NEXT") ("@shop")
- "\\<IGNORE\\>"))
-
; Allow setting single tags without the menu
(setq org-fast-tag-selection-single-key (quote expert))
nihil fit ex nihilo