From fc8a47cc6eb98e312c594bb29834c119fda1361e Mon Sep 17 00:00:00 2001
From: Adrian Bradd <adrian.bradd@gmail.com>
Date: Sun, 10 Dec 2017 16:07:57 -0500
Subject: [PATCH] lisp/org.el: Use marker for `change-plist' position property

* org.el (org-todo): Use marker `change-plist' position property to
  permit triggering through org-depend.el with parent heading
  statistics

When todo statistics in parent headings were updated it shifted the point
defining the :position property in `change-plist' causing headlines
with TRIGGER properties to fail to evaluate.

TINYCHANGE
---
 lisp/org.el | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/lisp/org.el b/lisp/org.el
index 4b4ce40..03de5ab 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -12379,6 +12379,7 @@ When called through ELisp, arg is also interpreted in the following way:
 	      (looking-at "\\(?: *\\|[ \t]*$\\)"))
 	  (let* ((match-data (match-data))
 		 (startpos (point-at-bol))
+		 (startmark (mark-marker))
 		 (logging (save-match-data (org-entry-get nil "LOGGING" t t)))
 		 (org-log-done org-log-done)
 		 (org-log-repeat org-log-repeat)
@@ -12461,7 +12462,7 @@ When called through ELisp, arg is also interpreted in the following way:
 			     org-state))
 		 (next (if org-state (concat " " org-state " ") " "))
 		 (change-plist (list :type 'todo-state-change :from this :to org-state
-				     :position startpos))
+				     :position (set-marker startmark startpos)))
 		 dolog now-done-p)
 	    (when org-blocker-hook
 	      (let (org-blocked-by-checkboxes block-reason)
-- 
2.10.1 (Apple Git-78)

