GNU bug report logs - #48133
28.0.50; [native-comp] time-to-days throws wrong-number-of-arguments error

Previous Next

Package: emacs;

Reported by: Ihor Radchenko <yantar92 <at> gmail.com>

Date: Sat, 1 May 2021 01:44:01 UTC

Severity: normal

Tags: fixed

Found in version 28.0.50

Fixed in version 28.1

Done: Lars Ingebrigtsen <larsi <at> gnus.org>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Ihor Radchenko <yantar92 <at> gmail.com>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 48133 <at> debbugs.gnu.org
Subject: bug#48133: 28.0.50; [native-comp] time-to-days throws wrong-number-of-arguments error
Date: Sat, 01 May 2021 16:22:32 +0800
Eli Zaretskii <eliz <at> gnu.org> writes:

> So maybe the problem is not in time-date.el, maybe it's elsewhere?
> Can you show the exact code of the test that fails and how to run it?

I run it by cloning Org mode repo from
https://code.orgmode.org/bzg/org-mode.git
and running =make test=

The failing test is test-org/deadline-close-p failing at the first
should assertion:

(ert-deftest test-org/deadline-close-p ()
  "Test `org-deadline-close-p' specifications."
  (org-test-at-time "2016-06-03 Fri 01:43"
    ;; Timestamps are close if they are within `ndays' of lead time.
    (org-test-with-temp-text "* Heading"
      (should (org-deadline-close-p "2016-06-03 Fri" 0))
      (should (org-deadline-close-p "2016-06-02 Thu" 0))
      (should-not (org-deadline-close-p "2016-06-04 Sat" 0))
      (should (org-deadline-close-p "2016-06-04 Sat" 1))
      (should (org-deadline-close-p "2016-06-03 Fri 12:00" 0)))
    ;; Read `ndays' from timestamp if argument not given.
    (org-test-with-temp-text "* H"
      (should (org-deadline-close-p "2016-06-04 Sat -1d"))
      (should-not (org-deadline-close-p "2016-06-04 Sat -0d"))
      (should (org-deadline-close-p "2016-06-10 Fri -1w"))
      (should-not (org-deadline-close-p "2016-06-11 Sat -1w")))
    ;; Prefer `ndays' argument over lead time in timestamp.
    (org-test-with-temp-text "* H"
      (should (org-deadline-close-p "2016-06-04 Sat -0d" 1))
      (should-not (org-deadline-close-p "2016-06-04 Sat -0d" 0)))
    ;; Completed tasks are never close.
    (let ((org-todo-keywords '(("TODO" "|" "DONE"))))
      (org-test-with-temp-text "* TODO Heading"
	(should (org-deadline-close-p "2016-06-03")))
      (org-test-with-temp-text "* DONE Heading"
	(should-not (org-deadline-close-p "2016-06-03"))))))

org-deadline-close-p code:

(defun org-deadline-close-p (timestamp-string &optional ndays)
  "Is the time in TIMESTAMP-STRING close to the current date?"
  (setq ndays (or ndays (org-get-wdays timestamp-string)))
  (and (<= (org-time-stamp-to-now timestamp-string) ndays)
       (not (org-entry-is-done-p))))

org-time-stamp-to-now:

(defun org-time-stamp-to-now (timestamp-string &optional seconds)
  "Difference between TIMESTAMP-STRING and now in days.
If SECONDS is non-nil, return the difference in seconds."
  (let ((fdiff (if seconds #'float-time #'time-to-days)))
    (- (funcall fdiff (org-time-string-to-time timestamp-string))
       (funcall fdiff nil))))





This bug report was last modified 4 years and 79 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.