[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] master 55283ff 015/135: Renamed to Org-Edna.

From: Ian Dunn
Subject: [elpa] master 55283ff 015/135: Renamed to Org-Edna.
Date: Mon, 17 Feb 2020 10:52:44 -0500 (EST)

branch: master
commit 55283ffd08a5ec6d55338e96b0be824a6647487b
Author: Ian D <address@hidden>
Commit: Ian D <address@hidden>

    Renamed to Org-Edna.
 Makefile                              |  14 ++--
 org-bat-tests.el => org-edna-tests.el |  24 +++---
 org-bat.el => org-edna.el             | 152 +++++++++++++++++-----------------
 README.org => org-edna.org            |  21 +++--
 4 files changed, 109 insertions(+), 102 deletions(-)

diff --git a/Makefile b/Makefile
index fcac54f..55498c7 100644
--- a/Makefile
+++ b/Makefile
@@ -1,4 +1,4 @@
-# This is part of org-bat
+# This is part of org-edna
 #  Copyright (C) 2017 Ian Dunn.
@@ -15,8 +15,8 @@
 #  You should have received a copy of the GNU General Public License
 #  along with this program.  If not, see <http://www.gnu.org/licenses/>.
-EMACS=emacs --batch
+EMACS=emacs --ednach
 TARGET=$(patsubst %.el,%.elc,$(SOURCE))
@@ -27,15 +27,15 @@ compile: $(TARGET)
 %.elc: %.el
        @$(EMACS) \
        -L "." \
-       -f batch-byte-compile $<
+       -f ednach-byte-compile $<
-autoloads: org-bat-autoloads.el
+autoloads: org-edna-autoloads.el
        @$(EMACS) \
        --eval "(require 'package)" \
        --eval "(setq inhibit-message t)" \
-       --eval "(package-generate-autoloads \"org-bat\" \"$$(pwd)\")"
+       --eval "(package-generate-autoloads \"org-edna\" \"$$(pwd)\")"
        -rm -f *.elc
diff --git a/org-bat-tests.el b/org-edna-tests.el
similarity index 72%
rename from org-bat-tests.el
rename to org-edna-tests.el
index 4a1e32f..33665a4 100644
--- a/org-bat-tests.el
+++ b/org-edna-tests.el
@@ -1,4 +1,4 @@
-;;; org-bat-tests.el --- Tests for org-bat
+;;; org-edna-tests.el --- Tests for org-edna
 ;; Author: Ian Dunn
@@ -6,12 +6,12 @@
 ;;; Code:
-(require 'org-bat)
+(require 'org-edna)
 (require 'ert)
-(ert-deftest org-bat-parse-form-no-arguments ()
+(ert-deftest org-edna-parse-form-no-arguments ()
   (let* ((input-string "test-string")
-         (parsed       (org-bat-parse-form input-string)))
+         (parsed       (org-edna-parse-form input-string)))
     (should parsed)
     (should (= (length parsed) 4))
     (pcase-let* ((`(,token ,args ,modifier ,pos) parsed))
@@ -20,9 +20,9 @@
       (should (not modifier))
       (should (= pos 11)))))
-(ert-deftest org-bat-parse-form-no-arguments-modifier ()
+(ert-deftest org-edna-parse-form-no-arguments-modifier ()
   (let* ((input-string "!test-string")
-         (parsed       (org-bat-parse-form input-string)))
+         (parsed       (org-edna-parse-form input-string)))
     (should parsed)
     (should (= (length parsed) 4))
     (pcase-let* ((`(,token ,args ,modifier ,pos) parsed))
@@ -31,9 +31,9 @@
       (should (eq modifier '!))
       (should (= pos 12)))))
-(ert-deftest org-bat-parse-form-single-argument ()
+(ert-deftest org-edna-parse-form-single-argument ()
   (let* ((input-string "test-string(abc)")
-         (parsed       (org-bat-parse-form input-string)))
+         (parsed       (org-edna-parse-form input-string)))
     (should parsed)
     (should (= (length parsed) 4))
     (pcase-let* ((`(,token ,args ,modifier ,pos) parsed))
@@ -44,9 +44,9 @@
       (should (not modifier))
       (should (= pos (length input-string))))))
-(ert-deftest org-bat-parse-form-string-argument ()
+(ert-deftest org-edna-parse-form-string-argument ()
   (let* ((input-string "test-string(abc,\"def (ghi)\")")
-         (parsed       (org-bat-parse-form input-string)))
+         (parsed       (org-edna-parse-form input-string)))
     (should parsed)
     (should (= (length parsed) 4))
     (pcase-let* ((`(,token ,args ,modifier ,pos) parsed))
@@ -59,6 +59,6 @@
       (should (not modifier))
       (should (= pos (length input-string))))))
-(provide 'org-bat-tests)
+(provide 'org-edna-tests)
-;;; org-bat-tests.el ends here
+;;; org-edna-tests.el ends here
diff --git a/org-bat.el b/org-edna.el
similarity index 77%
rename from org-bat.el
rename to org-edna.el
index 8ddbed3..e75127e 100644
--- a/org-bat.el
+++ b/org-edna.el
@@ -1,4 +1,4 @@
-;;; org-bat.el --- Extendable Blockers and Triggers -*- lexical-binding: t; -*-
+;;; org-edna.el --- Extendable Blockers and Triggers -*- lexical-binding: t; 
 ;; Author: Ian Dunn <address@hidden>
 ;; Keywords: convenience, text, org
@@ -12,7 +12,7 @@
 (require 'org)
 (require 'subr-x)
-(defun org-bat-parse-form (form)
+(defun org-edna-parse-form (form)
   (pcase-let* ((`(,token . ,pos) (read-from-string form))
                (modifier nil)
                (args nil))
@@ -53,25 +53,25 @@
       (setq token    (intern (match-string 2 (symbol-name token)))))
     (list token args modifier pos)))
-(defconst org-bat--types
+(defconst org-edna--types
   '(finder action condition)
-  "Types recognized by org-bat.")
+  "Types recognized by org-edna.")
-(defun org-bat--function-for-key (key)
+(defun org-edna--function-for-key (key)
     ((eq key 'consideration)
      ;; Function is ignored here
      (cons 'consideration 'identity))
-     (when-let ((func-format (format "org-bat-%%s/%s" key))
+     (when-let ((func-format (format "org-edna-%%s/%s" key))
                  ;; Find the first bound function
                   (lambda (sym) (fboundp (intern (format func-format sym))))
-                  org-bat--types)))
+                  org-edna--types)))
        (cons new-sym (intern (format func-format new-sym)))))))
-(defun org-bat--handle-condition (func mod args targets consideration)
+(defun org-edna--handle-condition (func mod args targets consideration)
   ;; Check the condition at each target
   (when-let ((blocks
@@ -80,9 +80,9 @@
                    (apply func mod args)))
     ;; Apply consideration
-    (org-bat-handle-consideration consideration blocks)))
+    (org-edna-handle-consideration consideration blocks)))
-(defun org-bat-process-form (form action-or-condition)
+(defun org-edna-process-form (form action-or-condition)
   (let ((targets)
         (form-string form)
@@ -91,8 +91,8 @@
         ;; Keep track of the current headline
         (last-entry (point-marker)))
     (while (not (string-empty-p form-string))
-      (pcase-let* ((`(,key ,args ,mod ,new-pos) (org-bat-parse-form 
-                   (`(,type . ,func) (org-bat--function-for-key key)))
+      (pcase-let* ((`(,key ,args ,mod ,new-pos) (org-edna-parse-form 
+                   (`(,type . ,func) (org-edna--function-for-key key)))
         (unless (and key type func)
           (user-error "Unrecognized form '%s'" form-string))
         (setq form-string (string-trim-left (substring form-string new-pos)))
@@ -121,20 +121,20 @@
            (setq state 'condition)
            (setq blocking-entry
                  (or blocking-entry  ;; We're already blocking
-                     (org-bat--handle-condition func mod args targets 
+                     (org-edna--handle-condition func mod args targets 
            ;; Consideration must be at the start of the targets, so clear out
            ;; any old targets.
            (setq targets nil)
            ;; The actual consideration will be the only argument
-           (setq consideration (org-bat-transform-consideration (nth 0 
+           (setq consideration (org-edna-transform-consideration (nth 0 
     ;; We exhausted the input string, but didn't find a condition when we were
     ;; expecting one.
     (when (and (eq action-or-condition 'condition) ;; Looking for conditions
                (eq state 'finder)                  ;; but haven't found any
                (not blocking-entry))                 ;; ever
       (setq blocking-entry
-            (org-bat--handle-condition 'org-bat-condition/done
+            (org-edna--handle-condition 'org-edna-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.
@@ -143,7 +143,7 @@
-(defmacro org-bat-run (change-plist &rest body)
+(defmacro org-edna-run (change-plist &rest body)
   (declare (indent 1))
   `(let* ((pos (plist-get ,change-plist :position))
           (type (plist-get ,change-plist :type))
@@ -160,33 +160,33 @@
        ;; is no block here.
-(defun org-bat-trigger-function (change-plist)
-  (org-bat-run change-plist
+(defun org-edna-trigger-function (change-plist)
+  (org-edna-run change-plist
     (when-let ((form (org-entry-get pos "TRIGGER")))
-      (org-bat-process-form form 'action))))
+      (org-edna-process-form form 'action))))
-(defun org-bat-blocker-function (change-plist)
-  (org-bat-run change-plist
+(defun org-edna-blocker-function (change-plist)
+  (org-edna-run change-plist
     (if-let ((form (org-entry-get pos "BLOCKER")))
-        (org-bat-process-form form 'condition)
+        (org-edna-process-form form 'condition)
-(defun org-bat-load ()
+(defun org-edna-load ()
-  (add-hook 'org-trigger-hook 'org-bat-trigger-function)
-  (add-hook 'org-blocker-hook 'org-bat-blocker-function))
+  (add-hook 'org-trigger-hook 'org-edna-trigger-function)
+  (add-hook 'org-blocker-hook 'org-edna-blocker-function))
-(defun org-bat-unload ()
+(defun org-edna-unload ()
-  (remove-hook 'org-trigger-hook 'org-bat-trigger-function)
-  (remove-hook 'org-blocker-hook 'org-bat-blocker-function))
+  (remove-hook 'org-trigger-hook 'org-edna-trigger-function)
+  (remove-hook 'org-blocker-hook 'org-edna-blocker-function))
 ;; Tag Finder
-(defun org-bat-finder/match (match-spec &optional scope skip)
+(defun org-edna-finder/match (match-spec &optional scope skip)
   "Find entries with match-spec MATCH-SPEC.
 MATCH-SPEC may be any valid match string; it is passed straight
@@ -204,16 +204,16 @@ SCOPE defaults to \"agenda\", and SKIP defaults to nil."
    match-spec scope skip))
 ;; ID finder
-(defun org-bat-finder/ids (&rest ids)
+(defun org-edna-finder/ids (&rest ids)
   "Find entries with IDs in IDS.
 IDS are all UUIDs as understood by `org-id-find'."
   (mapcar (lambda (id) (org-id-find id 'marker)) ids))
-(defun org-bat-finder/self ()
+(defun org-edna-finder/self ()
   (list (point-marker)))
-(defun org-bat-finder/siblings ()
+(defun org-edna-finder/siblings ()
    (let ((self (and (ignore-errors (org-back-to-heading t)) (point)))
@@ -225,22 +225,22 @@ IDS are all UUIDs as understood by `org-id-find'."
          (push (point-marker) markers)))
      (nreverse markers))))
-(defun org-bat-finder/next-sibling ()
+(defun org-edna-finder/next-sibling ()
    (and (org-get-next-sibling)
         (list (point-marker)))))
-(defun org-bat-finder/previous-sibling ()
+(defun org-edna-finder/previous-sibling ()
    (and (org-get-last-sibling)
         (list (point-marker)))))
-(defun org-bat-finder/first-child ()
+(defun org-edna-finder/first-child ()
    (and (org-goto-first-child)
         (list (point-marker)))))
-(defun org-bat-finder/children ()
+(defun org-edna-finder/children ()
    (let ((markers))
@@ -249,36 +249,36 @@ IDS are all UUIDs as understood by `org-id-find'."
        (push (point-marker) markers))
      (nreverse markers))))
-(defun org-bat-finder/parent ()
+(defun org-edna-finder/parent ()
    (and (org-up-heading-safe)
         (list (point-marker)))))
-(defun org-bat-finder/descendants ()
+(defun org-edna-finder/descendants ()
     (lambda nil (point-marker))
     nil 'tree)))
-(defun org-bat-finder/ancestors ()
+(defun org-edna-finder/ancestors ()
    (let ((markers))
      (while (org-up-heading-safe)
        (push (point-marker) markers))
      (nreverse markers))))
-(defun org-bat-finder/olp (file path)
+(defun org-edna-finder/olp (file path)
   (let ((marker (org-find-olp (cons file (split-string-and-unquote path 
     (when (markerp marker)
       (list marker))))
-(defun org-bat-finder/file (file)
+(defun org-edna-finder/file (file)
   ;; If there isn't a buffer visiting file, then there's no point in having a
   ;; marker to the start of the file.
   (with-current-buffer (find-file-noselect file)
     (list (point-min-marker))))
-(defun org-bat-finder/org-file (file)
+(defun org-edna-finder/org-file (file)
   "Finds FILE in `org-directory'."
   (with-current-buffer (find-file-noselect (expand-file-name file 
     (list (point-min-marker))))
@@ -286,28 +286,28 @@ IDS are all UUIDs as understood by `org-id-find'."
 ;; Set TODO state
-(defun org-bat-action/todo (last-entry new-state)
+(defun org-edna-action/todo (last-entry new-state)
   (ignore last-entry)
   (org-todo new-state))
 ;; Set planning info
-(defun org-bat--mod-timestamp (time-stamp n what)
+(defun org-edna--mod-timestamp (time-stamp n what)
     (insert time-stamp)
     (goto-char (point-min))
     (org-timestamp-change n what)
-(defun org-bat--get-planning-info (what)
+(defun org-edna--get-planning-info (what)
   (org-entry-get nil (if (eq what 'scheduled) "SCHEDULED" "DEADLINE")))
-(defun org-bat--handle-planning (type last-entry args)
+(defun org-edna--handle-planning (type last-entry args)
   ;; Need case-fold-search enabled so org-read-date-get-relative will 
recognize "M"
   (let* ((case-fold-search t)
          (arg (nth 0 args))
-         (last-ts (org-with-point-at last-entry (org-bat--get-planning-info 
-         (this-ts (org-bat--get-planning-info type))
+         (last-ts (org-with-point-at last-entry (org-edna--get-planning-info 
+         (this-ts (org-edna--get-planning-info type))
          (this-time (and this-ts (org-parse-time-string this-ts)))
          (current (org-current-time))
          (current-ts (format-time-string (org-time-stamp-format t) current))
@@ -320,7 +320,7 @@ IDS are all UUIDs as understood by `org-id-find'."
      ((member arg '("rm" "remove"))
       (org-add-planning-info nil nil type))
      ((member arg '("cp" "copy"))
-      ;; Copy old time verbatim
+      ;; Copy old time verednaim
       (org-add-planning-info type last-ts))
      ((string-match-p "\\`[+-]" arg)
       ;; We support hours and minutes, so this must be supported separately,
@@ -329,7 +329,7 @@ IDS are all UUIDs as understood by `org-id-find'."
       (pcase-let* ((`(,n ,what-string ,def) (org-read-date-get-relative arg 
this-time current))
                    (ts (if def current-ts this-ts))
                    (what (cdr (assoc-string what-string type-map))))
-        (org--deadline-or-schedule nil type (org-bat--mod-timestamp ts n 
+        (org--deadline-or-schedule nil type (org-edna--mod-timestamp ts n 
       ;; For everything else, assume `org-read-date-analyze' can handle it
       (let* ((parsed-time (org-read-date-analyze arg this-time (decode-time 
@@ -337,29 +337,29 @@ IDS are all UUIDs as understood by `org-id-find'."
              (new-ts (format-time-string "%F %R" final-time)))
         (org--deadline-or-schedule nil type new-ts))))))
-(defun org-bat-action/scheduled (last-entry &rest args)
-  (org-bat--handle-planning 'scheduled last-entry args))
+(defun org-edna-action/scheduled (last-entry &rest args)
+  (org-edna--handle-planning 'scheduled last-entry args))
-(defun org-bat-action/deadline (last-entry &rest args)
-  (org-bat--handle-planning 'deadline last-entry args))
+(defun org-edna-action/deadline (last-entry &rest args)
+  (org-edna--handle-planning 'deadline last-entry args))
-(defun org-bat-action/tag (last-entry tags)
+(defun org-edna-action/tag (last-entry tags)
   (ignore last-entry)
   (org-set-tags-to tags))
-(defun org-bat-action/set-property (last-entry property value)
+(defun org-edna-action/set-property (last-entry property value)
   (ignore last-entry)
   (org-entry-put nil property value))
-(defun org-bat-action/clock-in (last-entry)
+(defun org-edna-action/clock-in (last-entry)
   (ignore last-entry)
-(defun org-bat-action/clock-out (last-entry)
+(defun org-edna-action/clock-out (last-entry)
   (ignore last-entry)
-(defun org-bat-action/set-priority (last-entry priority-action)
+(defun org-edna-action/set-priority (last-entry priority-action)
   "PRIORITY-ACTION is passed straight to `org-priority'."
   (ignore last-entry)
   (org-priority (if (stringp priority-action)
@@ -367,15 +367,15 @@ IDS are all UUIDs as understood by `org-id-find'."
 ;; TODO I will likely want to check the arguments
-(defun org-bat-action/set-effort (last-entry value increment)
+(defun org-edna-action/set-effort (last-entry value increment)
   (ignore last-entry)
   (org-set-effort value increment))
-(defun org-bat-action/archive (last-entry)
+(defun org-edna-action/archive (last-entry)
   (ignore last-entry)
-(defun org-bat-action/chain (last-entry property)
+(defun org-edna-action/chain (last-entry property)
   (when-let ((old-prop (org-entry-get last-entry property)))
     (org-entry-put nil property old-prop)))
@@ -393,41 +393,41 @@ IDS are all UUIDs as understood by `org-id-find'."
 ;; This means that we want to take the exclusive-or of condition and neg.
-(defsubst org-bat--xor (lhs rhs)
+(defsubst org-edna--xor (lhs rhs)
   (or (and lhs (not rhs))
       (and (not lhs) rhs)))
-(defun org-bat-condition/done (neg)
+(defun org-edna-condition/done (neg)
   (when-let ((condition
               (if neg
                   (member (org-entry-get nil "TODO") org-not-done-keywords)
                 (member (org-entry-get nil "TODO") org-done-keywords))))
-(defun org-bat-condition/todo-state (neg state)
+(defun org-edna-condition/todo-state (neg state)
   (let ((condition (string-equal (org-entry-get nil "TODO") state)))
-    (when (org-bat--xor condition neg)
+    (when (org-edna--xor condition neg)
 ;; Block if there are headings
-(defun org-bat-condition/headings (neg)
+(defun org-edna-condition/headings (neg)
   (let ((condition (not (seq-empty-p (org-map-entries (lambda nil t))))))
-    (when (org-bat--xor condition neg)
+    (when (org-edna--xor condition neg)
-(defun org-bat-condition/variable-set (neg var val)
+(defun org-edna-condition/variable-set (neg var val)
   (let ((condition (string-equal (symbol-value (intern var)) (read val))))
-    (when (org-bat--xor condition neg)
+    (when (org-edna--xor condition neg)
       (format "%s %s= %s" var (or neg "=") val))))
-(defun org-bat-condition/has-property (neg prop val)
+(defun org-edna-condition/has-property (neg prop val)
   (let ((condition (string-equal (org-entry-get nil prop) val)))
-    (when (org-bat--xor condition neg)
+    (when (org-edna--xor condition neg)
-(defun org-bat-transform-consideration (consideration)
+(defun org-edna-transform-consideration (consideration)
   (pcase consideration
     ;; Leave symbols alone
     ('"all" (intern consideration))
@@ -437,7 +437,7 @@ IDS are all UUIDs as understood by `org-id-find'."
      (user-error "Unrecognized consideration '%s'" consideration))))
-(defun org-bat-handle-consideration (consideration blocks)
+(defun org-edna-handle-consideration (consideration blocks)
   (let ((first-block (seq-find #'identity blocks))
         (total-blocks (seq-length blocks)))
     (pcase consideration
@@ -459,6 +459,6 @@ IDS are all UUIDs as understood by `org-id-find'."
-(provide 'org-bat)
+(provide 'org-edna)
-;;; org-bat.el ends here
+;;; org-edna.el ends here
diff --git a/README.org b/org-edna.org
similarity index 92%
rename from README.org
rename to org-edna.org
index be38e19..d76a2b1 100644
--- a/README.org
+++ b/org-edna.org
@@ -1,7 +1,9 @@
-#+TITLE: Paced
+#+TITLE: Org Edna
 #+AUTHOR: Ian Dunn
 #+EMAIL: address@hidden
+Extensible Dependencies 'N' Actions for Org-Mode tasks
 * Copying
 Copyright (C) 2017 Ian Dunn
@@ -28,10 +30,11 @@ along with this program.  If not, see 
 - [ ] Stick with one of heading, headline, or entry; don't keep switching 
between them
-Org Blockers and Triggers (BAT) is an extensible means of specifying blocking
-conditions and trigger actions for Org headlines.
-Org BAT runs when either the BLOCKER or TRIGGER properties are set on a
+Edna provides an extensible means of specifying conditions which must be
+fulfilled before a task can be completed and actions to take once it is.
+Org Edna runs when either the BLOCKER or TRIGGER properties are set on a
 headline, and when it is changing from a TODO state to a DONE state.
 For brevity, we use TODO state to indicate any state in 
@@ -61,6 +64,10 @@ A trigger is an action triggered by setting a headline to 
 ** Finders
 A finder specifies locations from which to test conditions or perform actions.
 These locations are referred to as "targets".
+More than one finder may be used.  In this case, the targets are merged
+together, removing any duplicates.
 *** ancestors
 :DESCRIPTION: Find a list of ancestors
@@ -206,7 +213,7 @@ argument.
 :CUSTOM_ID: siblings
 ** Actions
-Once BAT has collected its targets for a trigger, it will perform actions on
+Once Edna has collected its targets for a trigger, it will perform actions on
 *** Scheduled/Deadline
 PLANNING(WKDY[ TIME]) -> Set PLANNING to following weekday WKDY at TIME
@@ -247,7 +254,7 @@ Sets the TODO state of the target headline to NEW-STATE.
 :CUSTOM_ID: conditions
-BAT gives you he option to specify *blocking conditions*.  Each condition is 
+Edna gives you he option to specify *blocking conditions*.  Each condition is 
 for each of the specified targets; if one of the conditions returns true for
 that target, then that headline is blocked.
@@ -316,4 +323,4 @@ The above code will allow task completion if at least one 
of ID1, ID2, and ID3
 are complete, and at least two of ID3, ID4, ID5, and ID6 are complete.
 If no consideration is given, ALL is assumed.
-* Extending BAT
+* Extending Edna

reply via email to

[Prev in Thread] Current Thread [Next in Thread]