[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] scratch/org-edna 8a8cfd6 12/72: Cleaned up condition handling
From: |
Ian Dunn |
Subject: |
[elpa] scratch/org-edna 8a8cfd6 12/72: Cleaned up condition handling |
Date: |
Sun, 21 May 2017 21:11:20 -0400 (EDT) |
branch: scratch/org-edna
commit 8a8cfd60d92aa9ccb1e33e68ed8046c369315120
Author: Ian D <address@hidden>
Commit: Ian D <address@hidden>
Cleaned up condition handling
* org-bat.el (org-bat--handle-condition): New function.
(org-bat-process-form): Use it.
---
org-bat.el | 37 +++++++++++++++++--------------------
1 file changed, 17 insertions(+), 20 deletions(-)
diff --git a/org-bat.el b/org-bat.el
index d360732..41c7627 100644
--- a/org-bat.el
+++ b/org-bat.el
@@ -71,6 +71,17 @@
org-bat--types)))
(cons new-sym (intern (format func-format new-sym)))))))
+(defun org-bat--handle-condition (func mod args targets consideration)
+ ;; Check the condition at each target
+ (when-let ((blocks
+ (mapcar
+ (lambda (entry-marker)
+ (org-with-point-at entry-marker
+ (apply func mod args)))
+ targets)))
+ ;; Apply consideration
+ (org-bat-handle-consideration consideration blocks)))
+
(defun org-bat-process-form (form action-or-condition)
(let ((targets)
(blocking-entry)
@@ -108,17 +119,9 @@
(unless targets
(message "Warning: Condition specified without targets"))
(setq state 'condition)
- (unless blocking-entry ;; We're already blocking
- ;; Check the condition at each target
- (when-let ((blocks
- (mapcar
- (lambda (entry-marker)
- (org-with-point-at entry-marker
- (apply func mod args)))
- targets)))
- ;; Apply consideration
- (setq blocking-entry
- (org-bat-handle-consideration consideration blocks)))))
+ (setq blocking-entry
+ (or blocking-entry ;; We're already blocking
+ (org-bat--handle-condition func mod args targets
consideration))))
('consideration
;; Consideration must be at the start of the targets, so clear out
;; any old targets.
@@ -130,15 +133,9 @@
(when (and (eq action-or-condition 'condition) ;; Looking for conditions
(eq state 'finder) ;; but haven't found any
(not blocking-entry)) ;; ever
- (when-let ((blocks
- (mapcar
- (lambda (entry-marker)
- (org-with-point-at entry-marker
- (org-bat-condition/done t)))
- targets)))
- ;; Apply consideration
- (setq blocking-entry
- (org-bat-handle-consideration consideration blocks))))
+ (setq blocking-entry
+ (org-bat--handle-condition 'org-bat-condition/done
+ t nil targets consideration)))
;; Only blockers care about the return value, and this will be non-nil if
;; the entry should be blocked.
(setq org-block-entry-blocking blocking-entry)
- [elpa] scratch/org-edna 5e69f84 04/72: Added .bzrignore., (continued)
- [elpa] scratch/org-edna 5e69f84 04/72: Added .bzrignore., Ian Dunn, 2017/05/21
- [elpa] scratch/org-edna 6ec67b8 10/72: Improved org-bat-parse-form to handle new argument types, Ian Dunn, 2017/05/21
- [elpa] scratch/org-edna 8b58c07 14/72: Clarified use of case-fold-search in `org-bat--handle-planning', Ian Dunn, 2017/05/21
- [elpa] scratch/org-edna 00ef89a 11/72: Added tests for org-bat-parse-form, Ian Dunn, 2017/05/21
- [elpa] scratch/org-edna 8aeb66c 08/72: Added more custom IDs to documentation, Ian Dunn, 2017/05/21
- [elpa] scratch/org-edna 89baba4 13/72: Added chain action, Ian Dunn, 2017/05/21
- [elpa] scratch/org-edna e2db4dc 19/72: Remove duplicate targets, Ian Dunn, 2017/05/21
- [elpa] scratch/org-edna 68b01b8 16/72: Fixed bug in Makefile, Ian Dunn, 2017/05/21
- [elpa] scratch/org-edna dc320fe 17/72: Use existing org-xor instead of new function, Ian Dunn, 2017/05/21
- [elpa] scratch/org-edna 0977b83 20/72: Don't assume arguments will be symbols or strings, Ian Dunn, 2017/05/21
- [elpa] scratch/org-edna 8a8cfd6 12/72: Cleaned up condition handling,
Ian Dunn <=
- [elpa] scratch/org-edna b40f7f0 05/72: Added initial documentation, Ian Dunn, 2017/05/21
- [elpa] scratch/org-edna 4a54e3b 09/72: Fixed headings condition, Ian Dunn, 2017/05/21
- [elpa] scratch/org-edna dcbb344 18/72: Fixed up indenting, Ian Dunn, 2017/05/21
- [elpa] scratch/org-edna ef34291 26/72: Fixed chain-find, Ian Dunn, 2017/05/21
- [elpa] scratch/org-edna 6cd8a40 28/72: Added test for parsing multiple forms, Ian Dunn, 2017/05/21
- [elpa] scratch/org-edna 3e1ed0c 29/72: Added re-search condition, Ian Dunn, 2017/05/21
- [elpa] scratch/org-edna c49aeba 36/72: Fixed consideration handling, Ian Dunn, 2017/05/21
- [elpa] scratch/org-edna 1dfc66f 01/72: Initial Commit., Ian Dunn, 2017/05/21
- [elpa] scratch/org-edna f05cf5e 23/72: Created finders for compatibility with org-depend, Ian Dunn, 2017/05/21
- [elpa] scratch/org-edna e8fc9d5 33/72: Added test for todo action, Ian Dunn, 2017/05/21