emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Repeated tasks repeats even if the time stamp is commented
@ 2014-07-18  9:19 Samuel Loury
  2014-07-18 10:32 ` Nicolas Goaziou
  0 siblings, 1 reply; 6+ messages in thread
From: Samuel Loury @ 2014-07-18  9:19 UTC (permalink / raw)
  To: OrgMode ML

[-- Attachment #1: Type: text/plain, Size: 2241 bytes --]

Hi,

In baa2c5943a4afce71a6336cbd957139e840bd952,

If the user toggles the TODO to DONE, the tasks repeats even though the
scheduled item is commented.
--8<---------------cut here---------------start------------->8---
* TODO Test
#  SCHEDULED: <2014-07-18 Fri ++1d>
--8<---------------cut here---------------end--------------->8---
My first though is that this behavior is unexpected, but I guess this
needs discussion.

I dug a bit and found two issues with this:
1. In org-add-planning-info, file lisp/org.el line 13446, the following
   code may be seen:
--8<---------------cut here---------------start------------->8---
	    (if (and (not (looking-at org-outline-regexp))
		     (looking-at (concat "[^\r\n]*?" org-keyword-time-regexp
					 "[^\r\n]*"))
		     (not (equal (match-string 1) org-clock-string)))
		(narrow-to-region (match-beginning 0) (match-end 0))
	      (insert-before-markers "\n")
	      (backward-char 1)
	      (narrow-to-region (point) (point))
	      (and org-adapt-indentation (org-indent-to-column col)))
--8<---------------cut here---------------end--------------->8---
  It assumes that (concat "[^\r\n]*?" org-keyword-time-regexp
  "[^\r\n]*") is a suitable regexp for time entry. It then make the
  buffer look like
--8<---------------cut here---------------start------------->8---
* DONE Test
  CLOSED: [2014-07-18 Fri 11:13] #  SCHEDULED: <2014-07-21 Mon ++1d>
--8<---------------cut here---------------end--------------->8---
2. afterward, into the org-get-repeat function, in the same file, line
   13094, the code is
--8<---------------cut here---------------start------------->8---
      (and (re-search-forward (if tagline
				  (concat tagline "\\s-*" org-repeat-re)
				org-repeat-re)
			      (org-entry-end-position) t)
	   (match-string-no-properties 1)))))
--8<---------------cut here---------------end--------------->8---
  This assumes also ignores a line starting with a #.

This case is a bit tricky to fix since if string matching org-repeat-re
is commented, then one has to search till the remaining of the entry to
find another one.

-- 
Konubinix
GPG Key    : 7439106A
Fingerprint: 5993 BE7A DA65 E2D9 06CE  5C36 75D2 3CED 7439 106A

[-- Attachment #2: Type: application/pgp-signature, Size: 472 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Repeated tasks repeats even if the time stamp is commented
  2014-07-18  9:19 Repeated tasks repeats even if the time stamp is commented Samuel Loury
@ 2014-07-18 10:32 ` Nicolas Goaziou
  2014-07-18 11:37   ` Samuel Loury
  0 siblings, 1 reply; 6+ messages in thread
From: Nicolas Goaziou @ 2014-07-18 10:32 UTC (permalink / raw)
  To: Samuel Loury; +Cc: OrgMode ML

Hello,

Samuel Loury <konubinix@gmail.com> writes:

> In baa2c5943a4afce71a6336cbd957139e840bd952,
>
> If the user toggles the TODO to DONE, the tasks repeats even though the
> scheduled item is commented.
> * TODO Test # SCHEDULED: <2014-07-18 Fri ++1d>
> My first though is that this behavior is unexpected, but I guess this
> needs discussion.

This is a long standing bug. It could be fixed if the part of Org
handling planning lines used the parser.

> I dug a bit and found two issues with this:
> 1. In org-add-planning-info, file lisp/org.el line 13446, the following
>    code may be seen:
> 	    (if (and (not (looking-at org-outline-regexp))
> 		     (looking-at (concat "[^\r\n]*?" org-keyword-time-regexp
> 					 "[^\r\n]*"))
> 		     (not (equal (match-string 1) org-clock-string)))
> 		(narrow-to-region (match-beginning 0) (match-end 0))
> 	      (insert-before-markers "\n")
> 	      (backward-char 1)
> 	      (narrow-to-region (point) (point))
> 	      (and org-adapt-indentation (org-indent-to-column col)))
>   It assumes that (concat "[^\r\n]*?" org-keyword-time-regexp
>   "[^\r\n]*") is a suitable regexp for time entry. It then make the
>   buffer look like
> * DONE Test
>   CLOSED: [2014-07-18 Fri 11:13] #  SCHEDULED: <2014-07-21 Mon ++1d>
> 2. afterward, into the org-get-repeat function, in the same file, line
>    13094, the code is
>       (and (re-search-forward (if tagline
> 				  (concat tagline "\\s-*" org-repeat-re)
> 				org-repeat-re)
> 			      (org-entry-end-position) t)
> 	   (match-string-no-properties 1)))))
>   This assumes also ignores a line starting with a #.
>
> This case is a bit tricky to fix since if string matching org-repeat-re
> is commented, then one has to search till the remaining of the entry to
> find another one.

The search should use `org-element-context' in order to know if point is
really at a timestamp.


Regards,

-- 
Nicolas Goaziou

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Repeated tasks repeats even if the time stamp is commented
  2014-07-18 10:32 ` Nicolas Goaziou
@ 2014-07-18 11:37   ` Samuel Loury
  2014-07-24  8:17     ` Nicolas Goaziou
  0 siblings, 1 reply; 6+ messages in thread
From: Samuel Loury @ 2014-07-18 11:37 UTC (permalink / raw)
  To: Nicolas Goaziou; +Cc: OrgMode ML

[-- Attachment #1: Type: text/plain, Size: 2248 bytes --]

Nicolas Goaziou <mail@nicolasgoaziou.fr> writes:

> Samuel Loury <konubinix@gmail.com> writes:
>
>> In baa2c5943a4afce71a6336cbd957139e840bd952,
>>
>> If the user toggles the TODO to DONE, the tasks repeats even though the
>> scheduled item is commented.
>> * TODO Test # SCHEDULED: <2014-07-18 Fri ++1d>
>> My first though is that this behavior is unexpected, but I guess this
>> needs discussion.
>
> This is a long standing bug. It could be fixed if the part of Org
> handling planning lines used the parser.

Thank you for the answer, do you know where I should look at to start
investigating to fix the issue?

>> I dug a bit and found two issues with this:
>> 1. In org-add-planning-info, file lisp/org.el line 13446, the following
>>    code may be seen:
>> 	    (if (and (not (looking-at org-outline-regexp))
>> 		     (looking-at (concat "[^\r\n]*?" org-keyword-time-regexp
>> 					 "[^\r\n]*"))
>> 		     (not (equal (match-string 1) org-clock-string)))
>> 		(narrow-to-region (match-beginning 0) (match-end 0))
>> 	      (insert-before-markers "\n")
>> 	      (backward-char 1)
>> 	      (narrow-to-region (point) (point))
>> 	      (and org-adapt-indentation (org-indent-to-column col)))
>>   It assumes that (concat "[^\r\n]*?" org-keyword-time-regexp
>>   "[^\r\n]*") is a suitable regexp for time entry. It then make the
>>   buffer look like
>> * DONE Test
>>   CLOSED: [2014-07-18 Fri 11:13] #  SCHEDULED: <2014-07-21 Mon ++1d>
>> 2. afterward, into the org-get-repeat function, in the same file, line
>>    13094, the code is
>>       (and (re-search-forward (if tagline
>> 				  (concat tagline "\\s-*" org-repeat-re)
>> 				org-repeat-re)
>> 			      (org-entry-end-position) t)
>> 	   (match-string-no-properties 1)))))
>>   This assumes also ignores a line starting with a #.
>>
>> This case is a bit tricky to fix since if string matching org-repeat-re
>> is commented, then one has to search till the remaining of the entry to
>> find another one.
>
> The search should use `org-element-context' in order to know if point is
> really at a timestamp.
I totally agree.

-- 
Konubinix
GPG Key    : 7439106A
Fingerprint: 5993 BE7A DA65 E2D9 06CE  5C36 75D2 3CED 7439 106A

[-- Attachment #2: Type: application/pgp-signature, Size: 472 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Repeated tasks repeats even if the time stamp is commented
  2014-07-18 11:37   ` Samuel Loury
@ 2014-07-24  8:17     ` Nicolas Goaziou
  2014-07-28 14:13       ` Bastien
  0 siblings, 1 reply; 6+ messages in thread
From: Nicolas Goaziou @ 2014-07-24  8:17 UTC (permalink / raw)
  To: Samuel Loury; +Cc: OrgMode ML

Hello,

Samuel Loury <konubinix@gmail.com> writes:

> Thank you for the answer, do you know where I should look at to start
> investigating to fix the issue?

I think `org-add-planning-info' may be a good candidate, though I didn't
look closely into it.

One possible way to use `org-element-at-point' is something like the
following

  (let ((element (org-element-at-point)))
    (when (eq (org-element-type element) 'planning)
      ...))

Then it is sure to be on a planning line. Storing ELEMENT also gives you
a lot of information without further parsing.

Also, when you need to find the next object of a given type, the usual
construct is

  (catch 'exit
    (while (re-search-forward some-regexp nil t)
      (let ((context (org-element-context)))
        (when (eq (org-element-type context) expected-type)
          ...
          (throw 'exit some-value)))))

It is useful to find, e.g., a timestamp within a section.


Regards,

-- 
Nicolas Goaziou

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Repeated tasks repeats even if the time stamp is commented
  2014-07-24  8:17     ` Nicolas Goaziou
@ 2014-07-28 14:13       ` Bastien
  2014-07-29 15:45         ` Samuel Loury
  0 siblings, 1 reply; 6+ messages in thread
From: Bastien @ 2014-07-28 14:13 UTC (permalink / raw)
  To: Nicolas Goaziou; +Cc: OrgMode ML, Samuel Loury

Hi Samuel and Nicolas,

Nicolas Goaziou <mail@nicolasgoaziou.fr> writes:

> Samuel Loury <konubinix@gmail.com> writes:
>
>> Thank you for the answer, do you know where I should look at to start
>> investigating to fix the issue?
>
> I think `org-add-planning-info' may be a good candidate, though I didn't
> look closely into it.

Is anyone having a closer look at this?

Otherwise I will, but at the end of august.

Thanks,

-- 
 Bastien

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Repeated tasks repeats even if the time stamp is commented
  2014-07-28 14:13       ` Bastien
@ 2014-07-29 15:45         ` Samuel Loury
  0 siblings, 0 replies; 6+ messages in thread
From: Samuel Loury @ 2014-07-29 15:45 UTC (permalink / raw)
  To: Bastien, Nicolas Goaziou; +Cc: OrgMode ML

[-- Attachment #1: Type: text/plain, Size: 744 bytes --]

Hi,
Bastien <bzg@gnu.org> writes:

> Nicolas Goaziou <mail@nicolasgoaziou.fr> writes:
>
>> Samuel Loury <konubinix@gmail.com> writes:
>>
>>> Thank you for the answer, do you know where I should look at to start
>>> investigating to fix the issue?
>>
>> I think `org-add-planning-info' may be a good candidate, though I didn't
>> look closely into it.
>
> Is anyone having a closer look at this?
>
> Otherwise I will, but at the end of august.
I don't think I will look at this soon. I added an entry in my todo.org
but I couldn't find any time to schedule it yet...

If I work on it, I'll let you know.

Best regards,
-- 
Konubinix
GPG Key    : 7439106A
Fingerprint: 5993 BE7A DA65 E2D9 06CE  5C36 75D2 3CED 7439 106A

[-- Attachment #2: Type: application/pgp-signature, Size: 472 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2014-07-29 15:46 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-07-18  9:19 Repeated tasks repeats even if the time stamp is commented Samuel Loury
2014-07-18 10:32 ` Nicolas Goaziou
2014-07-18 11:37   ` Samuel Loury
2014-07-24  8:17     ` Nicolas Goaziou
2014-07-28 14:13       ` Bastien
2014-07-29 15:45         ` Samuel Loury

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).