From 11d533ead8092e0d060770992064119a1c8aa05f Mon Sep 17 00:00:00 2001 From: Sean Whitton Date: Wed, 13 Mar 2024 15:01:54 +0800 Subject: attempt to replace three Org agenda skip subroutines --- .emacs.d/init.el | 35 ++++++----------------------------- 1 file changed, 6 insertions(+), 29 deletions(-) diff --git a/.emacs.d/init.el b/.emacs.d/init.el index 6dc25e3e..a6e3eb72 100644 --- a/.emacs.d/init.el +++ b/.emacs.d/init.el @@ -5256,7 +5256,7 @@ different occasions." ;; we used to skip deadlined standalone tasks but actually those ;; are actionable in general ;; (and (spw/is-task-p) - ;; (spw/org-has-deadline-p)) + ;; (org-agenda-skip-entry-if 'deadline)) ;; #4--#7 (and (spw/is-subproject-p) @@ -5272,37 +5272,14 @@ different occasions." ;; # 6 (string= (nth 2 (org-heading-components)) "WAITING") ;; # 7 - (spw/org-is-scheduled-p))))))))) - -;; We look only right after the headline for SCHEDULED: and DEADLINE:, whereas -;; `org-agenda-check-for-timestamp-as-reason-to-ignore-todo-item' searches -;; until the next headline. This should be okay because I only ever put those -;; on the line right after the headline. -(cl-macrolet ((task-with-first-line-such-that (&body forms) - `(and (spw/is-task-or-project-p) - (save-excursion (beginning-of-line-text 2) ,@forms)))) - (defun spw/org-is-scheduled-p () - "A task that is scheduled." - (task-with-first-line-such-that - (when (looking-at (org-re-timestamp 'deadline)) - (goto-char (match-end 0)) (skip-syntax-forward "\\s-")) - (looking-at (org-re-timestamp 'scheduled)))) - - (defun spw/org-has-deadline-p () - "A task that has a deadline." - (task-with-first-line-such-that - (when (looking-at (org-re-timestamp 'scheduled)) - (goto-char (match-end 0)) (skip-syntax-forward "\\s-")) - (looking-at (org-re-timestamp 'deadline)))) - - (defun spw/org-is-scheduled-or-deadlined-p () - "A task that is scheduled or has a deadline." - (task-with-first-line-such-that - (looking-at (org-re-timestamp 'scheduled-or-deadline))))) + (org-agenda-skip-entry-if 'scheduled))))))))) (defun spw/has-scheduled-or-deadlined-subproject-p () "A task that has a scheduled or deadlined subproject" - (spw/has-subheading-such-that (spw/org-is-scheduled-or-deadlined-p))) + (and (not (org-before-first-heading-p)) + (spw/has-subheading-such-that + (and (spw/is-task-or-project-p) + (org-agenda-skip-entry-if 'scheduled 'deadline))))) (defun spw/has-next-action-p () "A task that has a NEXT subproject" -- cgit v1.2.3