From: Rasmus <rasmus@gmx.us>
To: kyle@kyleam.com
Cc: emacs-orgmode@gnu.org
Subject: Re: [PATCH] org-closest-date: Don't accept canceled repeater
Date: Wed, 15 Jul 2015 19:17:25 +0200 [thread overview]
Message-ID: <87h9p51gt6.fsf@gmx.us> (raw)
In-Reply-To: <87wpy4nlkc.fsf@kyleam.com> (Kyle Meyer's message of "Mon, 13 Jul 2015 11:06:59 -0400")
Hi,
Thanks for the example.
Kyle Meyer <kyle@kyleam.com> writes:
> Sorry, I should have included an example.
>
> If I have a heading that looks like
>
> ** TODO h
> DEADLINE: <2015-07-13 Mon +3w>
>
> and I run org-todo with a numeric prefix of -1, the repeater is canceled
> by changing it to +0w:
I see. Shouldn't org-todo rather remove the repeater?
> ** DONE h
> CLOSED: [2015-07-13 Mon 10:47] DEADLINE: <2015-07-13 Mon +0w>
>
> If I call org-agenda-list on a file with an entry like above, I get an
> arith-error from +0w being passed to org-closest-date.
On your patch:
> (+ daynr 1000)))
> - ((and daynr (string-match "\\+[0-9]+[hdwmy]" s))
> + ((and daynr (not (string-match "\\+0[hdwmy]" s))
> + (string-match "\\+[0-9]+[hdwmy]" s))
for no particular reason I prefer:
(and daynr (string-match "\\+\\([0-9]+\\)[hdwmy]" s)
(> (string-to-number (match-string 1)) 0))
You can also use (not (zerop ·)). But feel free to use whatever you
prefer.
> - (setq dn (string-to-number (match-string 1 change))
> - dw (cdr (assoc (match-string 2 change) a1)))
> + (when (string-match "\\(\\+[0-9]+\\)\\([hdwmy]\\)" change)
> + (setq dn (string-to-number (match-string 1 change))
> + dw (cdr (assoc (match-string 2 change) a1))))
> + (unless (wholenump dn)
Shouldn'it it also test that dn > 0?
Rasmus
--
To err is human. To screw up 10⁶ times per second, you need a computer
next prev parent reply other threads:[~2015-07-15 17:17 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-07-11 2:58 [PATCH] org-closest-date: Don't accept canceled repeater Kyle Meyer
2015-07-13 10:07 ` Rasmus
2015-07-13 15:06 ` Kyle Meyer
2015-07-15 17:17 ` Rasmus [this message]
2015-07-16 1:50 ` Kyle Meyer
2015-07-16 9:44 ` Rasmus
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=87h9p51gt6.fsf@gmx.us \
--to=rasmus@gmx.us \
--cc=emacs-orgmode@gnu.org \
--cc=kyle@kyleam.com \
/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).