From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp2 ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms11 with LMTPS id 8DztMAJh/V+RZwAA0tVLHw (envelope-from ) for ; Tue, 12 Jan 2021 08:42:42 +0000 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp2 with LMTPS id +KjXLAJh/V8AEQAAB5/wlQ (envelope-from ) for ; Tue, 12 Jan 2021 08:42:42 +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 0E5CE940414 for ; Tue, 12 Jan 2021 08:42:42 +0000 (UTC) Received: from localhost ([::1]:50826 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kzFGD-00060w-17 for larch@yhetil.org; Tue, 12 Jan 2021 03:42:41 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:50490) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kzFEs-00060k-9j for emacs-orgmode@gnu.org; Tue, 12 Jan 2021 03:41:18 -0500 Received: from forward1-smtp.messagingengine.com ([66.111.4.223]:33491) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kzFEp-0003MG-HF for emacs-orgmode@gnu.org; Tue, 12 Jan 2021 03:41:18 -0500 Received: from compute5.internal (compute5.nyi.internal [10.202.2.45]) by mailforward.nyi.internal (Postfix) with ESMTP id 9595719C2548 for ; Tue, 12 Jan 2021 03:41:13 -0500 (EST) Received: from mailfrontend2 ([10.202.2.163]) by compute5.internal (MEProxy); Tue, 12 Jan 2021 03:41:13 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-me-proxy :x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm1; bh=88JGey oXYr5WNm8Dai+dniTaC+d2inE76bWFdzSbSlk=; b=sCWrzORaPTbEvDIidb7y4u BAr4/SIif3jyaykp63CaGE+4sbfVZTKM6L2XTPF+SjordX6dtwe30nh7r7z6zD5F Dl29RNxDsJUh2pnHr5KiOoX83K1s6XkNAjGOpE4XI+cPvxH9RcgwY+j34+QCL2/b znxEiZqeH3NGFc2n5ILRZKnGfpk8QMZNvfCaqYfqFToX9JsZw+MerLGx8UNTlkNa CwEXWxl5eQE7aQtxF4Jc5cE+52wAGz8n2QHHv5UispokrqjWxQHu2r3orIDxKWAc QbALu/AefSYPrOtFH+r6rFqWn4TSNXzEaRgvGjrtwB5JuXs8hoDglZQ1SxeZ3v+A == X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedujedrvdehvddguddvfecutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfgh necuuegrihhlohhuthemuceftddtnecunecujfgurhephffvufgjfhffkfggtgesmhdtre ertddttdenucfhrhhomheptfhitghhrghrugcunfgrfihrvghntggvuceorhhitghhrghr ugdrlhgrfihrvghntggvsehunhhiqdhtuhgvsghinhhgvghnrdguvgeqnecuggftrfgrth htvghrnhepvefhvdefveevudejleeugfffveeuudekveehhfetudeljeetfedvtddtleej vddunecukfhppeegiedrhedrvdehhedrleeknecuvehluhhsthgvrhfuihiivgeptdenuc frrghrrghmpehmrghilhhfrhhomheprhiflhesfhgrshhtmhgrihhlrdgtohhm X-ME-Proxy: Received: from aquinas (hsi-kbw-046-005-255-098.hsi8.kabel-badenwuerttemberg.de [46.5.255.98]) by mail.messagingengine.com (Postfix) with ESMTPA id 35DE81080059 for ; Tue, 12 Jan 2021 03:41:13 -0500 (EST) Received: from rwl by aquinas with local (Exim 4.92) (envelope-from ) id 1kzFEk-0007fY-5r for emacs-orgmode@gnu.org; Tue, 12 Jan 2021 09:41:10 +0100 From: Richard Lawrence To: emacs-orgmode@gnu.org Subject: [PATCH] incorrect timestamps with :time-prompt and datetrees In-Reply-To: <87ble2uuoa.fsf@aquinas> References: <87h7obh4ct.fsf@aquinas> <87eejfh0fm.fsf@aquinas> <87ble2uuoa.fsf@aquinas> Date: Tue, 12 Jan 2021 09:41:10 +0100 Message-ID: <87ft364kex.fsf@aquinas> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Received-SPF: neutral client-ip=66.111.4.223; envelope-from=rwl@fastmail.com; helo=forward1-smtp.messagingengine.com X-Spam_score_int: -12 X-Spam_score: -1.3 X-Spam_bar: - X-Spam_report: (-1.3 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, FREEMAIL_FORGED_FROMDOMAIN=0.248, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.249, RCVD_IN_DNSWL_LOW=-0.7, SPF_HELO_PASS=-0.001, SPF_NEUTRAL=0.779 autolearn=no autolearn_force=no X-Spam_action: no action 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" X-Migadu-Flow: FLOW_IN X-Migadu-Spam-Score: -2.06 Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=messagingengine.com header.s=fm1 header.b=sCWrzORa; 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-Migadu-Queue-Id: 0E5CE940414 X-Spam-Score: -2.06 X-Migadu-Scanner: scn0.migadu.com X-TUID: osI7j/UU6kZ+ --=-=-= Content-Type: text/plain Hi everyone, Bumping this, since I forgot to put "PATCH" in the subject line before. Richard Lawrence writes: > Here is a patch for this issue. It uses a narrower regex to match a time > range. This regex requires time ranges to have ":MM" or an AM/PM > specification in the end time, to prevent mangling strings that are > interpreted as dates, like "11-12". > > This patch is a minimal change that gets the code working in the way > that seems to have been intended, so it seems worth applying to maint. > > However, the way the code is intended to work doesn't seem right to me, > because it simply throws away time range information at the time prompt. > If you enter a time range like "13:00-14:00" at the time prompt, you > will get a timestamp with "13:00" for the time when the %T template is > expanded. (This is because org-capture-set-target-location uses the > beginning of the entered time range to set :default-time, which must be > an encoded time value, and there is no obvious way to set a time range.) > This is a surprising contrast with the behavior of %^T, which preserves > the time range information in the timestamp entered. But fixing this > will be a larger change and possibly requires some discussion. -- Best, Richard --=-=-= Content-Type: text/x-diff Content-Disposition: attachment; filename=0001-org-capture-fix-expansion-of-T-when-capturing-to-a-d.patch >From a6c223664aad6096943e236c9a51c30246e57669 Mon Sep 17 00:00:00 2001 From: Richard Lawrence Date: Wed, 6 Jan 2021 11:53:42 +0100 Subject: [PATCH] org-capture: fix expansion of %T when capturing to a datetree * org-capture.el (org-capture-set-target-location): Use a narrower regular expression to replace a time range by its start time when setting :default-time, so that dates do not get mangled. TINYCHANGE --- lisp/org-capture.el | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lisp/org-capture.el b/lisp/org-capture.el index f40f2b335..df0eccdbb 100644 --- a/lisp/org-capture.el +++ b/lisp/org-capture.el @@ -1038,12 +1038,12 @@ Store them in the capture property list." (apply #'encode-time 0 0 org-extend-today-until (cl-cdddr (decode-time prompt-time)))) - ((string-match "\\([^ ]+\\)-[^ ]+[ ]+\\(.*\\)" + ((string-match "\\(--?\\([012]?[0-9]\\)\\(\\(:[0-5][0-9]\\)\\|\\(am\\|AM\\|pm\\|PM\\)\\>\\)\\)\\(.*\\)" org-read-date-final-answer) ;; Replace any time range by its start. (apply #'encode-time (org-read-date-analyze - (replace-match "\\1 \\2" nil nil + (replace-match "\\6" nil nil org-read-date-final-answer) prompt-time (decode-time prompt-time)))) (t prompt-time))) -- 2.20.1 --=-=-=--