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 sKmWClqi114BNQAA0tVLHw (envelope-from ) for ; Wed, 03 Jun 2020 13:15:06 +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 KIyGBlqi116KVgAAB5/wlQ (envelope-from ) for ; Wed, 03 Jun 2020 13:15:06 +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 7688494053B for ; Wed, 3 Jun 2020 13:15:05 +0000 (UTC) Received: from localhost ([::1]:37846 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jgTEW-00079t-9r for larch@yhetil.org; Wed, 03 Jun 2020 09:15:04 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:52696) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jgTEB-00079K-VS for emacs-orgmode@gnu.org; Wed, 03 Jun 2020 09:14:43 -0400 Received: from mail-qt1-x82a.google.com ([2607:f8b0:4864:20::82a]:39915) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jgTEA-0004Ua-70; Wed, 03 Jun 2020 09:14:43 -0400 Received: by mail-qt1-x82a.google.com with SMTP id k22so1923850qtm.6; Wed, 03 Jun 2020 06:14:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:references:user-agent:from:to:cc:subject:in-reply-to :message-id:date:mime-version; bh=8tSVBhvRyeYopBSeeDb5j38sCMnmrlUaElzyUuCZRyw=; b=XkrhiTjMR+v3Br+Zu6iyg1yuewAuCMwndR7Xl5DFikCf2bjLUQQinqAFNM4+3Djp37 I++t+flacViOKJsNLxc445mJLj8bCenbYSfJp5/kiKFhFjkILQq5b8WstVhDLON06oKU QF0EEiMVtZv+8OvFlPqY8gORfhWCnucM/AVmljJmZ9R6JQWfZwALM1gWCUtG2eRoPqaR Ent6tL3fIVSups7QOlkqtZfyfXRi3fpnjqdvzY9An1wquXvRV7mGN8ceQa3QBsJrdGdm oSXoN3E03k1Tk5PFlSl92MxFfaaIQGCw0fG7uQntK/WEpa1osCOMjecarIn0tI6h+UDA ea8w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:references:user-agent:from:to:cc:subject :in-reply-to:message-id:date:mime-version; bh=8tSVBhvRyeYopBSeeDb5j38sCMnmrlUaElzyUuCZRyw=; b=e264Hn9PxtsD29oGrdOpzpYCXZkDQr3zkIUUi4iKrNnla3wjsCNUTxMo/NKIaWtwXI MjCMt6z+FDJBxUF6nJ1BQu51cuqZDJm5VwPErtMap7+aF/GcQfrDrdGBP9xDLelbIY/Y zJAJXAVkTk0hgsm2KeUojrWv4K+8riyU8dnjw8GwYCDB0EIieF+2MCWj0ZSOLplNXd4g rP5vO984o9K/L25CtNu25eJtrFEjayRe73Sf4MS8dvGrTybR6O982He6/FABB6B2pPjh 8Mus4AUAHC1sw5PGiReKQsgoFr8CHREapzTDHSrFlqvQIuuo8tyi9v5/SUxpYQOJRiJ0 hhkg== X-Gm-Message-State: AOAM531+ZL/hshrjK+oSy7QaDjvxlgtfDz0ovdnTbER7oWAGzix4i4aa DwUmtabCtrFQak4iViozLkpgIB3u X-Google-Smtp-Source: ABdhPJzI38FDYofnSupixhn9iq0UX8SnxABqOti31nXFQzoWVhEnRoERIlbFOVp4Wvu8eCBveqRhIQ== X-Received: by 2002:ac8:181:: with SMTP id x1mr32935601qtf.163.1591190079744; Wed, 03 Jun 2020 06:14:39 -0700 (PDT) Received: from gusbrs-laptop ([191.30.238.205]) by smtp.gmail.com with ESMTPSA id s45sm1998381qte.26.2020.06.03.06.14.33 (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 03 Jun 2020 06:14:38 -0700 (PDT) References: <875zcpqxnq.fsf@gmail.com> <87a71lacw6.fsf@bzg.fr> User-agent: mu4e 1.4.8; emacs 27.0.91 From: Gustavo Barros To: Bastien Subject: Re: A small idea to simplify (further) time input in the date/time prompt In-reply-to: <87a71lacw6.fsf@bzg.fr> Message-ID: <87a71kqojx.fsf@gmail.com> Date: Wed, 03 Jun 2020 10:14:26 -0300 MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Received-SPF: pass client-ip=2607:f8b0:4864:20::82a; envelope-from=gusbrs.2016@gmail.com; helo=mail-qt1-x82a.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: -17 X-Spam_score: -1.8 X-Spam_bar: - X-Spam_report: (-1.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_ENVFROM_END_DIGIT=0.25, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001 autolearn=_AUTOLEARN 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: , Cc: emacs-orgmode@gnu.org Errors-To: emacs-orgmode-bounces+larch=yhetil.org@gnu.org Sender: "Emacs-orgmode" X-Scanner: scn0 Authentication-Results: aspmx1.migadu.com; dkim=fail (rsa verify failed) header.d=gmail.com header.s=20161025 header.b=XkrhiTjM; dmarc=fail reason="SPF not aligned (relaxed)" header.from=gmail.com (policy=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-Spam-Score: 0.09 X-TUID: AKsNSSUgvKK7 --=-=-= Content-Type: text/plain; format=flowed Hi Bastien, On Tue, Jun 02 2020, Bastien wrote: > Hi Gustavo, > > I like this idea, thanks for proposing it. We are in feature freeze > for core features, so we have time to work on this for Org 9.5. > [...] > Would you agree? Would you like to work on this change? Well, I did give it a shot. And, as it turns out, this might be manageable within my limitations. A preliminary patch is attached, for comments. I took here the stance of following the same treatment which is given to am/pm times, and of using the letter "h" as sole main identifier. In particular, standard "HH:MM" times take precedence, as is the case for am/pm times. And duration specification with numbers only are presumed to be hours, which was already the case, the patch does not introduce any changes here. The input will match for this format for "number h 2-digit-number", where either the hour or the minutes, but not both, can be omitted and, if so, is presumed to be zero. 24h format is also presumed. With it, some example inputs/outputs for time in the date/time prompt: | input | output | |-----------+-------------| | 9h | 09:00 | | h45 | 00:45 | | 21h | 21:00 | | 9h-10h | 09:00-10:00 | | 9h--10h30 | 09:00-10:30 | | 18h30+h30 | 18:30-19:00 | | 18h30+1 | 18:30-19:30 | | 18h30+1h | 18:30-19:30 | And some sanity checks: | input | output | Observation | |-----------+----------------------+-------------------------------------------| | 10:00 9h | 10:00 | by design, as for am/pm times | | 10am 9h | 10:00 | expected from coming after am/pm handling | | 10:00-11h | 10:00-11:00 | | | 10h-11:00 | no match | am/pm also does not match here | | +9h | no match | | | -9h | no match | | | h | no match | | | 10h+h | no match | | | h5 | no match | | | 10h70 | no match | | | 29h | 2020-06-04 Thu 05:00 | makes sense, same as for 29:00 | | 30h | no match | as per the regexp | WDYT? Best, Gustavo. --=-=-= Content-Type: text/x-diff Content-Disposition: attachment; filename=0001-date-time-prompt-Provide-support-for-HHhMM-time-inpu.patch >From 02829c7771a1f7a0c00d607a924fb8f56d2f3dd6 Mon Sep 17 00:00:00 2001 From: Gustavo Barros Date: Wed, 3 Jun 2020 08:57:53 -0300 Subject: [PATCH] date/time prompt: Provide support for HHhMM time input * lisp/org.el (org-read-date-analyze): Add support for HHhMM time input, in similar way as for am/pm times. * doc/org-manual.org (The date/time prompt): Add example to illustrate the feature. TINYCHANGE --- doc/org-manual.org | 1 + lisp/org.el | 13 +++++++++++++ 2 files changed, 14 insertions(+) diff --git a/doc/org-manual.org b/doc/org-manual.org index 92252179b..bfd2aea1f 100644 --- a/doc/org-manual.org +++ b/doc/org-manual.org @@ -6017,6 +6017,7 @@ dash(es) as the separator in the former case and use =+= as the separator in the latter case, e.g.: | =11am-1:15pm= | \rArr{} 11:00-13:15 | +| =11h-13h15= | \rArr{} same as above | | =11am--1:15pm= | \rArr{} same as above | | =11am+2:15= | \rArr{} same as above | diff --git a/lisp/org.el b/lisp/org.el index b869e12e1..8333e1a5a 100644 --- a/lisp/org.el +++ b/lisp/org.el @@ -13981,6 +13981,19 @@ user." (setq ans (replace-match (format "%02d:%02d" hour minute) t t ans)))) + ;; Help matching HHhMM times, similarly as for am/pm times. + (cl-loop for i from 1 to 2 do ; twice, for end time as well + (when (and (not (string-match "\\(\\`\\|[^+]\\)[012]?[0-9]:[0-9][0-9]\\([ \t\n]\\|$\\)" ans)) + (string-match "\\(?:\\(?1:[012]?[0-9]\\)?h\\(?2:[0-5][0-9]\\)\\)\\|\\(?:\\(?1:[012]?[0-9]\\)h\\(?2:[0-5][0-9]\\)?\\)\\>" ans)) + (setq hour (if (match-end 1) + (string-to-number (match-string 1 ans)) + 0) + minute (if (match-end 2) + (string-to-number (match-string 2 ans)) + 0)) + (setq ans (replace-match (format "%02d:%02d" hour minute) + t t ans)))) + ;; Check if a time range is given as a duration (when (string-match "\\([012]?[0-9]\\):\\([0-6][0-9]\\)\\+\\([012]?[0-9]\\)\\(:\\([0-5][0-9]\\)\\)?" ans) (setq hour (string-to-number (match-string 1 ans)) -- 2.17.1 --=-=-=--