emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [O] [PATCH] org-closest-date: Don't accept canceled repeater


From: Rasmus
Subject: Re: [O] [PATCH] org-closest-date: Don't accept canceled repeater
Date: Wed, 15 Jul 2015 19:17:25 +0200
User-agent: Gnus/5.130014 (Ma Gnus v0.14) Emacs/25.0.50 (gnu/linux)

Hi,

Thanks for the example.

Kyle Meyer <address@hidden> 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

[Prev in Thread] Current Thread [Next in Thread]