From mboxrd@z Thu Jan 1 00:00:00 1970 From: Rasmus Subject: Re: [PATCH] org-closest-date: Don't accept canceled repeater Date: Wed, 15 Jul 2015 19:17:25 +0200 Message-ID: <87h9p51gt6.fsf@gmx.us> References: <87380viemx.fsf@kmlap.domain.org> <87mvz01icw.fsf@gmx.us> <87wpy4nlkc.fsf@kyleam.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:60283) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZFQJJ-0006vE-Fw for emacs-orgmode@gnu.org; Wed, 15 Jul 2015 13:17:34 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZFQJG-0001SW-8D for emacs-orgmode@gnu.org; Wed, 15 Jul 2015 13:17:33 -0400 Received: from mout.gmx.net ([212.227.17.22]:61057) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZFQJF-0001SN-UA for emacs-orgmode@gnu.org; Wed, 15 Jul 2015 13:17:30 -0400 In-Reply-To: <87wpy4nlkc.fsf@kyleam.com> (Kyle Meyer's message of "Mon, 13 Jul 2015 11:06:59 -0400") List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: kyle@kyleam.com Cc: emacs-orgmode@gnu.org Hi, Thanks for the example. Kyle Meyer 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 =C2=B7)). 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 --=20 To err is human. To screw up 10=E2=81=B6 times per second, you need a compu= ter