unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Bastien <bzg@gnu.org>
To: emacs-devel@gnu.org
Cc: Paul Eggert <paul.eggert@verizon.net>
Subject: [PATCH] Fix for `parse-time-string'
Date: Fri, 24 Jan 2020 11:06:19 +0100	[thread overview]
Message-ID: <87iml1yxr8.fsf@bzg.fr> (raw)

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

Hi Paul,

07a4dd8e6a introduces a change in the behavior of `parse-time-string':

(parse-time-string "2020-12-12")
  [before 07a4dd8e6a] => (nil nil nil 12 12 2020 nil nil nil)
   [after 07a4dd8e6a] => (0 0 0 12 12 2020 nil -1 nil)

The current docstring seems to suggest that the current implementation
should return (nil nil nil 12 12 2020 nil -1 nil).

I suggest the attached patch to revert to the previous behavior while
still having the benefits of the new implementation.

The new behavior causes an annoying bug in Org-mode: re-scheduling a
headline from the calendar introduces a default time value ("00:00")
even when there is no time in the timestamp.

WDYT?

Thanks,

-- 
 Bastien

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: parse-time.el.patch --]
[-- Type: text/x-diff, Size: 565 bytes --]

diff --git a/lisp/calendar/parse-time.el b/lisp/calendar/parse-time.el
index 6a4612297c..b199fca2db 100644
--- a/lisp/calendar/parse-time.el
+++ b/lisp/calendar/parse-time.el
@@ -158,7 +158,7 @@ parse-time-string
 any unknown values other than DST are returned as nil, and an
 unknown DST value is returned as -1."
   (condition-case ()
-      (decoded-time-set-defaults (iso8601-parse string))
+      (iso8601-parse string)
     (wrong-type-argument
      (let ((time (list nil nil nil nil nil nil nil -1 nil))
 	   (temp (parse-time-tokenize (downcase string))))

             reply	other threads:[~2020-01-24 10:06 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-01-24 10:06 Bastien [this message]
2020-01-24 15:41 ` [PATCH] Fix for `parse-time-string' Lars Ingebrigtsen
2020-01-24 21:45   ` Paul Eggert
2020-01-25  8:43     ` Bastien

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.gnu.org/software/emacs/

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

  git send-email \
    --in-reply-to=87iml1yxr8.fsf@bzg.fr \
    --to=bzg@gnu.org \
    --cc=emacs-devel@gnu.org \
    --cc=paul.eggert@verizon.net \
    /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.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).