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 ms11 with LMTPS id QBwaGzLiMF9fEwAA0tVLHw (envelope-from ) for ; Mon, 10 Aug 2020 05:59:14 +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 GNcNFzLiMF/jXwAA1q6Kng (envelope-from ) for ; Mon, 10 Aug 2020 05:59:14 +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 744BC94004E for ; Mon, 10 Aug 2020 05:59:13 +0000 (UTC) Received: from localhost ([::1]:38262 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1k50pz-0001zp-9q for larch@yhetil.org; Mon, 10 Aug 2020 01:59:11 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:44866) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1k50pW-0001zM-L7 for emacs-orgmode@gnu.org; Mon, 10 Aug 2020 01:58:42 -0400 Received: from mail-qt1-x843.google.com ([2607:f8b0:4864:20::843]:36033) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1k50pU-0001BB-QV for emacs-orgmode@gnu.org; Mon, 10 Aug 2020 01:58:42 -0400 Received: by mail-qt1-x843.google.com with SMTP id t23so5957812qto.3 for ; Sun, 09 Aug 2020 22:58:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=references:user-agent:from:to:cc:subject:in-reply-to:message-id :date:mime-version; bh=TJlH6q2R09j72BqAnfVPdAA8K+KZ/uFpiwpbAdbHqoY=; b=R3FryzgnEWrtDlXH1WjdxdYJvudFmW+GB+Zl3++5hEpRTrU1JKJRrJmoHxR9Fy0W3g HgFzTBFSaXAOW5LOjHXV6tTFVZLzHggc+nVvEZJZG8Poi/iCA43KqdZuQ4TQkvBEU169 OGTK9n2FfYBGfQwFFASTIs+JUuK5VtJi5fcDnmwWDOocdcTaSDP3d4kLtiaJ/Z/jsgC4 p7K4Evd2DQc0m8SIgUkjj0TyTORLWD4KqZefiJt6zyogYiYR264xiNMu5rtym0LZP7ZT 5PFgjvaHSVEQxf93JB+bhPvisKakD4RwaPLN5MBWN2huIb5+a+KijXze5c+jHZVAjI10 2Qkg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:references:user-agent:from:to:cc:subject :in-reply-to:message-id:date:mime-version; bh=TJlH6q2R09j72BqAnfVPdAA8K+KZ/uFpiwpbAdbHqoY=; b=KDkErXsh4A3yPPSjfEybgOmTB63KghM3KKr1BSeBlL83MxQvHpUK/jCiM0aohWhC/9 595cOTAhO2TmezMr1Akx+vL8YoDFfe2jmlQf5GtgHUmwPEbK372C7oDWS160vtAQ9P3q wN0daAJ7cu6UFDtzpV4RVOBN9HaoTIHYEpCePOSD5u1jsQpbgMtrTMOuN5JNmJ8ahM6B M8ATen9WsLq5K4yMQVipgTWj9PbWFU7Jk0FqhXQ2xIJHBpixHdESH1OS1RtqHeIzgQb1 0sf5t+Q91pZyOkaMv6+tlGKz42xm/n3PDKvJyjMQKScupmhhzIVKzlrOG29IJwr/ClKv XjbQ== X-Gm-Message-State: AOAM530vjsFZ0q+A7yvXvwAY4ScAGcN+BqlYQvYpoHplko0VPasg6P5p B5NO4+WDdq0dWTY/2YVwMKeNqjrb/W0= X-Google-Smtp-Source: ABdhPJwFDqVXGPKPFqKnYOpnEvIsrOv17tvxAXpqVgu9X+ihCdRDMSVatevCJufiLotMPXSX6Z7QeA== X-Received: by 2002:ac8:5416:: with SMTP id b22mr25187728qtq.45.1597039118773; Sun, 09 Aug 2020 22:58:38 -0700 (PDT) Received: from arch ([2601:8b:c300:1024:1266:d0ff:1635:f964]) by smtp.gmail.com with ESMTPSA id q126sm13103960qkb.75.2020.08.09.22.58.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 09 Aug 2020 22:58:37 -0700 (PDT) References: <87tuxkc1zp.fsf@gmail.com> <87r1sf9jyz.fsf@kyleam.com> User-agent: mu4e 1.5.5; emacs 28.0.50 From: No Wayman To: Kyle Meyer Subject: Re: [PATCH] org-get-cursor-date regexp patch In-reply-to: <87r1sf9jyz.fsf@kyleam.com> Message-ID: <87tuxb59g0.fsf@gmail.com> Date: Mon, 10 Aug 2020 01:58:07 -0400 MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Received-SPF: pass client-ip=2607:f8b0:4864:20::843; envelope-from=iarchivedmywholelife@gmail.com; helo=mail-qt1-x843.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: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 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_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham 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: , 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=pass header.d=gmail.com header.s=20161025 header.b=R3Fryzgn; dmarc=pass (policy=none) header.from=gmail.com; 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: -1.71 X-TUID: ZWdJmb8tLLUm --=-=-= Content-Type: text/plain; format=flowed > Makes sense. IMO it'd be nice to see something along the lines > of this > explanation in the commit message itself. > > The function name is missing here: > > * lisp/org.el (org-get-cursor-date): ... > To my eyes, the new variable doesn't add any clarity over > keeping it > inline. Addressed in attached patch. > Also, I very much like rx and I'm okay if you want to stick with > it > here, but in this particular case I find it less readable than > > \\([0-9]?[0-9]\\):\\([0-9][0-9]\\) > > or the stricter > > \\([0-2]?[0-9]\\):\\([0-5][0-9]\\) Fair enough. My preference for how the regular expression is notated does not matter so long as it is the correct expression. I've inlined your second, stricter regular expression. --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=0001-org.el-org-get-cursor-date-Fix-regular-expression.patch Content-Description: org-get-cursor-date-regexp-revised >From cad2044829e6d3ff76c2a3504564ed5bfcc36bfb Mon Sep 17 00:00:00 2001 From: Nicholas Vollmer Date: Sun, 2 Aug 2020 14:42:34 -0400 Subject: [PATCH] org.el: (org-get-cursor-date): Fix regular expression * lisp/org.el (org-get-cursor-date): Fix regular expression. Previous regular expression assumed the time grid string will have two digits in the hour portion of the time string. However, the time grid string does not always have two digits. For example: " 8:00......" --- lisp/org.el | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/lisp/org.el b/lisp/org.el index ee8be256d..f8dbb6307 100644 --- a/lisp/org.el +++ b/lisp/org.el @@ -18731,22 +18731,22 @@ earliest time on the cursor date that Org treats as that date (let (date day defd tp hod mod) (when with-time (setq tp (get-text-property (point) 'time)) - (when (and tp (string-match "\\([0-9][0-9]\\):\\([0-9][0-9]\\)" tp)) + (when (and tp (string-match "\\([0-2]?[0-9]\\):\\([0-5][0-9]\\)" tp)) (setq hod (string-to-number (match-string 1 tp)) - mod (string-to-number (match-string 2 tp)))) + mod (string-to-number (match-string 2 tp)))) (or tp (let ((now (decode-time))) - (setq hod (nth 2 now) - mod (nth 1 now))))) + (setq hod (nth 2 now) + mod (nth 1 now))))) (cond ((eq major-mode 'calendar-mode) (setq date (calendar-cursor-to-date) - defd (encode-time 0 (or mod 0) (or hod org-extend-today-until) - (nth 1 date) (nth 0 date) (nth 2 date)))) + defd (encode-time 0 (or mod 0) (or hod org-extend-today-until) + (nth 1 date) (nth 0 date) (nth 2 date)))) ((eq major-mode 'org-agenda-mode) (setq day (get-text-property (point) 'day)) (when day (setq date (calendar-gregorian-from-absolute day) - defd (encode-time 0 (or mod 0) (or hod org-extend-today-until) + defd (encode-time 0 (or mod 0) (or hod org-extend-today-until) (nth 1 date) (nth 0 date) (nth 2 date)))))) (or defd (current-time)))) -- 2.28.0 --=-=-=--