Hi,

Thanks for the example.

Kyle Meyer <k...@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




Reply via email to