[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] master 029bc2e 012/135: Cleaned up condition handling
From: |
Ian Dunn |
Subject: |
[elpa] master 029bc2e 012/135: Cleaned up condition handling |
Date: |
Mon, 17 Feb 2020 10:52:44 -0500 (EST) |
branch: master
commit 029bc2e8fc6a5b91aaae798acfc514b718d542a0
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] master 6886b8a 026/135: Fixed chain-find, (continued)
- [elpa] master 6886b8a 026/135: Fixed chain-find, Ian Dunn, 2020/02/17
- [elpa] master 55283ff 015/135: Renamed to Org-Edna., Ian Dunn, 2020/02/17
- [elpa] master d348102 025/135: Added file for tests, Ian Dunn, 2020/02/17
- [elpa] master 71cdc0a 027/135: Fixed parsing bug, Ian Dunn, 2020/02/17
- [elpa] master 6b9a676 031/135: Added documentation for each condition, Ian Dunn, 2020/02/17
- [elpa] master 71e00e4 036/135: Fixed consideration handling, Ian Dunn, 2020/02/17
- [elpa] master 9f27779 014/135: Clarified use of case-fold-search in `org-bat--handle-planning', Ian Dunn, 2020/02/17
- [elpa] master 13e752b 021/135: Fix uses of substring, Ian Dunn, 2020/02/17
- [elpa] master 3937f31 009/135: Fixed headings condition, Ian Dunn, 2020/02/17
- [elpa] master 975da4b 010/135: Improved org-bat-parse-form to handle new argument types, Ian Dunn, 2020/02/17
- [elpa] master 029bc2e 012/135: Cleaned up condition handling,
Ian Dunn <=
- [elpa] master 602ad6d 011/135: Added tests for org-bat-parse-form, Ian Dunn, 2020/02/17
- [elpa] master a70f9ac 016/135: Fixed bug in Makefile, Ian Dunn, 2020/02/17
- [elpa] master abb0083 018/135: Fixed up indenting, Ian Dunn, 2020/02/17
- [elpa] master cb1f51f 020/135: Don't assume arguments will be symbols or strings, Ian Dunn, 2020/02/17
- [elpa] master 180d05b 022/135: Added configuration option to use inheritance, Ian Dunn, 2020/02/17
- [elpa] master b38a1ca 024/135: Added tests for ids and match finders, Ian Dunn, 2020/02/17
- [elpa] master 30fc4cd 023/135: Created finders for compatibility with org-depend, Ian Dunn, 2020/02/17
- [elpa] master 9916819 028/135: Added test for parsing multiple forms, Ian Dunn, 2020/02/17
- [elpa] master fc0dcc1 029/135: Added re-search condition, Ian Dunn, 2020/02/17
- [elpa] master c675036 030/135: Added test for empty argument list, Ian Dunn, 2020/02/17