emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Ihor Radchenko <yantar92@gmail.com>
To: Org-mode <emacs-orgmode@gnu.org>
Subject: [PATCH] Fix regression in org-get-time-of-day introduced in aba1f2066
Date: Sun, 20 Jun 2021 17:17:11 +0800	[thread overview]
Message-ID: <87fsxcj3oo.fsf@localhost> (raw)

[-- Attachment #1: Type: text/plain, Size: 121 bytes --]


The new version of org-get-time-of-day errors on empty string argument.
The attached patch is fixing this.

Best,
Ihor


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-Fix-regression-in-org-get-time-of-day-introduced-in-.patch --]
[-- Type: text/x-diff, Size: 1234 bytes --]

From b615265881bdbb65f9a99d9f076424cb2233b250 Mon Sep 17 00:00:00 2001
Message-Id: <b615265881bdbb65f9a99d9f076424cb2233b250.1624180543.git.yantar92@gmail.com>
From: Ihor Radchenko <yantar92@gmail.com>
Date: Sun, 20 Jun 2021 17:15:34 +0800
Subject: [PATCH] Fix regression in org-get-time-of-day introduced in aba1f2066

* lisp/org-agenda.el (org-get-time-of-day): Do not check 'face
property when S argument is an empty string.  The old version of the
code would throw error on (get-text-property 1 'face s).
---
 lisp/org-agenda.el | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/lisp/org-agenda.el b/lisp/org-agenda.el
index a6bc8bcf0..f9077f0c8 100644
--- a/lisp/org-agenda.el
+++ b/lisp/org-agenda.el
@@ -6995,7 +6995,8 @@ (defun org-get-time-of-day (s &optional string)
                  (group-n 3 (or "am" "pm")))
              word-end)))
     (save-match-data
-      (when (and (not (eq 'org-link (get-text-property 1 'face s)))
+      (when (and (not (string-empty-p s))
+                 (not (eq 'org-link (get-text-property 1 'face s)))
                  (string-match time-regexp s))
         (let ((hours
                (let* ((ampm (and (match-end 3) (downcase (match-string 3 s))))
-- 
2.31.1


             reply	other threads:[~2021-06-20  9:17 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-20  9:17 Ihor Radchenko [this message]
2021-06-20 16:09 ` [PATCH] Fix regression in org-get-time-of-day introduced in aba1f2066 Nicolas Goaziou
2021-07-24 19:48   ` Timothy

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87fsxcj3oo.fsf@localhost \
    --to=yantar92@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).