From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp0 ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms1 with LMTPS id 1iy9AkLkiV4RCQAAk0OIDg (envelope-from ) for ; Sun, 05 Apr 2020 13:59:30 +0000 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp0 with LMTPS id CG7oHkDkiV6DbQAA1q6Kng (envelope-from ) for ; Sun, 05 Apr 2020 13:59:28 +0000 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 58F1294291A for ; Sun, 5 Apr 2020 13:59:26 +0000 (UTC) Received: from localhost ([::1]:48170 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jL5o3-0000l6-Mn for larch@yhetil.org; Sun, 05 Apr 2020 09:59:23 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:58293) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jL5nP-0000kx-7t for emacs-orgmode@gnu.org; Sun, 05 Apr 2020 09:58:44 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1jL5nK-0000Oy-BB for emacs-orgmode@gnu.org; Sun, 05 Apr 2020 09:58:42 -0400 Received: from relay1-d.mail.gandi.net ([217.70.183.193]:63671) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1jL5nK-0000Mu-54 for emacs-orgmode@gnu.org; Sun, 05 Apr 2020 09:58:38 -0400 X-Originating-IP: 185.131.40.67 Received: from localhost (40-67.ipv4.commingeshautdebit.fr [185.131.40.67]) (Authenticated sender: admin@nicolasgoaziou.fr) by relay1-d.mail.gandi.net (Postfix) with ESMTPSA id 4E9DD240004 for ; Sun, 5 Apr 2020 13:58:34 +0000 (UTC) From: Nicolas Goaziou To: emacs-orgmode@gnu.org Subject: Do something useful with ".+" and hours repeaters Mail-Followup-To: emacs-orgmode@gnu.org Date: Sun, 05 Apr 2020 15:58:33 +0200 Message-ID: <87k12uavau.fsf@nicolasgoaziou.fr> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.3 (gnu/linux) MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 217.70.183.193 X-BeenThere: emacs-orgmode@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+larch=yhetil.org@gnu.org Sender: "Emacs-orgmode" ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=default; t=1586095167; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type:list-id:list-help:list-unsubscribe: list-subscribe:list-post; bh=f3n4E4oEWw1lbvOGfWwObIj0ulHU10l6bi4MKRDTw/U=; b=jRa6ejCyczeLpKQicd4JTFoftbgyMeENfSA9+CHiW9YQDE6vIKUr8yJZ0hMjXcovB06Vkf 88XljtSlKe2oYp8IQ1EKwgVa77xFO/o6efdDvo5Q7IoN2Z/jyr2ca9+aogwu5+zjgsi9mA rzuu/KIEBoxnXBVSspPeft3VtC7civw= ARC-Seal: i=1; s=default; d=yhetil.org; t=1586095167; a=rsa-sha256; cv=none; b=qqnVHFSguWWaxyFZmh2j19y6izoc3fmISS1XAYLvfq8gpHs8Au+d7BFBbwP4aEYinnkGUL rpiXTVI+0hPUpZrJ+Wi0AUQih3SDx6EkerlOVhchuQUNcYVnsltkNvN0DPXqaDKfGTMIPy QnnhHXNJ13jv+jqseplxgSMfoNnXQAg= ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=none; dmarc=none; spf=pass (aspmx1.migadu.com: domain of emacs-orgmode-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=emacs-orgmode-bounces@gnu.org X-Scanner: scn0 X-Spam-Score: -1.01 Authentication-Results: aspmx1.migadu.com; dkim=none; dmarc=none; spf=pass (aspmx1.migadu.com: domain of emacs-orgmode-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=emacs-orgmode-bounces@gnu.org X-Scan-Result: default: False [-1.01 / 13.00]; RCVD_VIA_SMTP_AUTH(0.00)[]; GENERIC_REPUTATION(0.00)[-0.585545447816]; HAS_XOIP(0.00)[]; R_SPF_ALLOW(-0.20)[+ip4:209.51.188.0/24:c]; IP_REPUTATION_HAM(0.00)[asn: 22989(0.33), country: US(-0.01), ip: 209.51.188.17(-0.59)]; TO_DN_NONE(0.00)[]; ARC_SIGNED(0.00)[i=1]; MX_GOOD(-0.50)[cached: eggs.gnu.org]; MAILLIST(-0.20)[mailman]; FORGED_RECIPIENTS_MAILLIST(0.00)[]; RCVD_TLS_LAST(0.00)[]; R_DKIM_NA(0.00)[]; ASN(0.00)[asn:22989, ipnet:209.51.188.0/24, country:US]; MID_RHS_MATCH_FROM(0.00)[]; TAGGED_FROM(0.00)[larch=yhetil.org]; ARC_NA(0.00)[]; RCVD_COUNT_FIVE(0.00)[6]; FROM_NEQ_ENVFROM(0.00)[mail@nicolasgoaziou.fr,emacs-orgmode-bounces@gnu.org]; FROM_HAS_DN(0.00)[]; MIME_GOOD(-0.10)[multipart/mixed,text/plain,text/x-diff]; PREVIOUSLY_DELIVERED(0.00)[emacs-orgmode@gnu.org]; DMARC_NA(0.00)[nicolasgoaziou.fr]; HAS_LIST_UNSUB(-0.01)[]; RCPT_COUNT_ONE(0.00)[1]; MIME_TRACE(0.00)[0:+,1:+,2:+]; FORGED_SENDER_MAILLIST(0.00)[] X-TUID: ep3ldLgHrqlX --=-=-= Content-Type: text/plain Hello, Someone on #org-mode (sorry, I cannot remember the nickname) reported that ".+" repeater style was not handling properly (not handling at all, actually) hours spans. As a reminder, ".+" means "repeat, starting from today as the base date". With hours, it seems logical to "repeat, starting from now as the base date". The attached patch does that. WDYT? -- Nicolas Goaziou --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=0001-Handle-.-repeater-style-for-hours.patch Content-Description: Fix ".+" repeater style for hour span >From 19ee311eb35bc4cde08e61bc485a679df2d584dd Mon Sep 17 00:00:00 2001 From: Nicolas Goaziou Date: Sun, 5 Apr 2020 15:47:45 +0200 Subject: [PATCH] Handle ".+" repeater style for hours * lisp/org.el (org-auto-repeat-maybe): Handle ".+" repeater style for hours. * doc/org-manual.org (Repeated tasks): Add an example. --- doc/org-manual.org | 4 ++++ lisp/org.el | 11 ++++++++--- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/doc/org-manual.org b/doc/org-manual.org index 5f55e9bd5..ee054a744 100644 --- a/doc/org-manual.org +++ b/doc/org-manual.org @@ -6337,6 +6337,10 @@ special repeaters =++= and =.+=. For example: ,** TODO Check the batteries in the smoke detectors DEADLINE: <2005-11-01 Tue .+1m> Marking this DONE will shift the date to one month after today. + +,** TODO Play a major third while pushing the bird through the door + DEADLINE: <2019-04-05 08:00 Sun .+1h> + Marking this DONE shifts the date to exactly one hour from now. #+end_example #+vindex: org-agenda-skip-scheduled-if-deadline-is-shown diff --git a/lisp/org.el b/lisp/org.el index 06891b8bd..b9742514d 100644 --- a/lisp/org.el +++ b/lisp/org.el @@ -10146,9 +10146,14 @@ This function is run automatically after each state change to a DONE state." (repeater-type (match-string 1 ts))) (cond ((equal "." repeater-type) - ;; Shift starting date to today. - (org-timestamp-change (- (org-today) (time-to-days time)) - 'day)) + ;; Shift starting date to today, or now if + ;; repeater is by hours. + (if (equal what "h") + (org-timestamp-change + (floor (/ (- (org-time-stamp-to-now ts t)) 60)) + 'minute) + (org-timestamp-change (- (org-today) (time-to-days time)) + 'day))) ((equal "+" repeater-type) (let ((nshiftmax 10) (nshift 0)) -- 2.26.0 --=-=-=--