emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Adrian Bradd <adrian.bradd@gmail.com>
To: emacs-orgmode <emacs-orgmode@gnu.org>
Subject: BUG: TODO statistics in parent heading prevent evaluation of TODOs with TRIGGER property
Date: Sun, 10 Dec 2017 16:25:35 -0500	[thread overview]
Message-ID: <CAMYmr8xT3D5G9zOO=ZMi-aLjAd+fwfvU6CUGttXRPUDKoX5-uA@mail.gmail.com> (raw)


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

Hi,

Please see the patch attached.

When completing a TODO with a TRIGGER property that has statistics in the
parent headline the trigger would not evaluate because the :position
property in `change-plist' may now refer to the line above the original
TODO.

I have used a marker to avoid the issue with the point moving due to the
addition of characters
​ in the parent headline​
. Not sure if this is the best way to solve the problem.

Cheers,

Adrian

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

[-- Attachment #2: 0001-lisp-org.el-Use-marker-for-change-plist-position-pro.patch --]
[-- Type: application/octet-stream, Size: 1593 bytes --]

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)


             reply	other threads:[~2017-12-10 21:25 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-12-10 21:25 Adrian Bradd [this message]
2017-12-10 21:53 ` BUG: TODO statistics in parent heading prevent evaluation of TODOs with TRIGGER property Nicolas Goaziou
2017-12-10 22:50   ` Adrian Bradd
2017-12-10 22:51     ` Adrian Bradd
2017-12-26  3:55       ` Adrian Bradd
2017-12-27 22:59         ` 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='CAMYmr8xT3D5G9zOO=ZMi-aLjAd+fwfvU6CUGttXRPUDKoX5-uA@mail.gmail.com' \
    --to=adrian.bradd@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    /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).