emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Adrian Bradd <adrian.bradd@gmail.com>
To: Nicolas Goaziou <mail@nicolasgoaziou.fr>
Cc: emacs-orgmode@gnu.org
Subject: Re: [PATCH] org-depend: multi-file TRIGGER and BLOCKER tasks
Date: Sat, 29 Jul 2017 19:12:04 -0400	[thread overview]
Message-ID: <CAMYmr8y8gOBMys7VDBptyZR-jJyZew-WZpCDDNuFQXMms+qWOA@mail.gmail.com> (raw)
In-Reply-To: <87o9s4u0z2.fsf@nicolasgoaziou.fr>


[-- Attachment #1.1: Type: text/plain, Size: 101 bytes --]

I have attached an amended version. Let me know if there are any other
changes that need to be made.

[-- Attachment #1.2: Type: text/html, Size: 254 bytes --]

[-- Attachment #2: 0001-contrib-lisp-org-depend.el-org-depend-trigger-todo-o.patch --]
[-- Type: text/x-patch, Size: 2664 bytes --]

From d18f299c2dfe3610e04b156d08a70ddafb052ab2 Mon Sep 17 00:00:00 2001
From: Adrian Bradd <adrian.bradd@gmail.com>
Date: Thu, 13 Jul 2017 22:49:26 -0400
Subject: [PATCH] contrib/lisp/org-depend.el (org-depend-trigger-todo,
 org-depend-block-todo): multi-file TRIGGER and BLOCKER tasks

---
 contrib/lisp/org-depend.el | 26 +++++++++++++++++++++-----
 1 file changed, 21 insertions(+), 5 deletions(-)

diff --git a/contrib/lisp/org-depend.el b/contrib/lisp/org-depend.el
index d1b98441c..136a14eb2 100644
--- a/contrib/lisp/org-depend.el
+++ b/contrib/lisp/org-depend.el
@@ -211,7 +211,7 @@ This does two different kinds of triggers:
 	 (from (plist-get change-plist :from))
 	 (to (plist-get change-plist :to))
 	 (org-log-done nil) ; IMPROTANT!: no logging during automatic trigger!
-	 trigger triggers tr p1 kwd id)
+	 trigger triggers tr p1 p2 kwd id)
     (catch 'return
       (unless (eq type 'todo-state-change)
 	;; We are only handling todo-state-change....
@@ -336,11 +336,18 @@ This does two different kinds of triggers:
 	  (setq id (match-string 1 tr)
 		kwd (match-string 2 tr)
 		p1 (org-find-entry-with-id id))
-	  (when p1
+	  ;; first check current buffer, then all files
+	  (if p1
 	    ;; there is an entry with this ID, mark it TODO
 	    (save-excursion
 	      (goto-char p1)
-	      (org-todo kwd))))
+	      (org-todo kwd))
+	    (when (setq p2 (org-id-find id))
+	      (save-excursion
+		(with-current-buffer
+		  (find-file-noselect (car p2))
+		  (goto-char (cdr p2))
+		  (org-todo kwd))))))
          ((string-match "\\`chain-siblings-scheduled\\'" tr)
           (let ((time (org-get-scheduled-time pos)))
             (when time
@@ -362,7 +369,7 @@ this ID property, that entry is also checked."
 	 (from (plist-get change-plist :from))
 	 (to (plist-get change-plist :to))
 	 (org-log-done nil) ; IMPROTANT!: no logging during automatic trigger
-	 blocker blockers bl p1
+	 blocker blockers bl p1 p2
 	 (proceed-p
 	  (catch 'return
             ;; If this is not a todo state change, or if this entry is
@@ -403,7 +410,16 @@ this ID property, that entry is also checked."
 		  (unless (org-entry-is-done-p)
 		    ;; return nil, to indicate that we block the change!
 		    (org-mark-ring-push)
-		    (throw 'return nil))))))
+		    (throw 'return nil))))
+	       
+	       ((setq p2 (org-id-find bl))
+		(save-excursion
+		  (with-current-buffer
+		    (find-file-noselect (car p2))
+		    (goto-char (cdr p2))
+		    (unless (org-entry-is-done-p)
+		      (org-mark-ring-push)
+		      (throw 'return nil)))))))
 	    t ; return t to indicate that we are not blocking
 	    )))
     (when org-depend-tag-blocked
-- 
2.11.0


  reply	other threads:[~2017-07-29 23:12 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-07-28  2:12 [PATCH] org-depend: multi-file TRIGGER and BLOCKER tasks Adrian Bradd
2017-07-28 13:48 ` Nicolas Goaziou
2017-07-29 23:12   ` Adrian Bradd [this message]
2017-08-01  8:34     ` Nicolas Goaziou

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAMYmr8y8gOBMys7VDBptyZR-jJyZew-WZpCDDNuFQXMms+qWOA@mail.gmail.com \
    --to=adrian.bradd@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    --cc=mail@nicolasgoaziou.fr \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).