From: Paul Eggert <eggert@cs.ucla.edu>
To: Michael Albinus <michael.albinus@gmx.de>
Cc: emacs-devel@gnu.org
Subject: Re: master d0c77a1: Remove some assumptions about timestamp format
Date: Fri, 28 Sep 2018 10:39:38 -0700 [thread overview]
Message-ID: <3356af4b-f6f5-e353-6162-a5fa8880d223@cs.ucla.edu> (raw)
In-Reply-To: <877ej5ap0o.fsf@gmx.de>
[-- Attachment #1: Type: text/plain, Size: 860 bytes --]
Michael Albinus wrote:
> Shouldn't this be `time-equal-p', as we have already `time-less-p'?
Thanks, as a Scheme refugee I never can remember which predicates should end in
"-p" vs "p" vs nothing. I installed the attached.
> Tramp (and other functions) must check, whether a given time value
> is the "don't know" value. Therefore,
>
> (time-equal time-value 0.0e+NaN)
>
> must return t, if time-value is a NaN. And what if either value is a
> float infinity?
It appears that NaN isn't what Tramp wants. As a time value, NaN should work
like floating-point NaN does; it should never compare numerically equal to
anything, not even to itself (anything else would lead to even more confusion
than what we already have :-). I hope that my other suggestion for Tramp
suffices, so that we don't need to worry about what happens with NaNs in
comparisons.
[-- Attachment #2: 0001-Rename-time-equal-to-time-equal-p.patch --]
[-- Type: text/x-patch, Size: 2777 bytes --]
From 857c2c271080ef62e57128f531cee6e974ca28fb Mon Sep 17 00:00:00 2001
From: Paul Eggert <eggert@cs.ucla.edu>
Date: Fri, 28 Sep 2018 10:32:41 -0700
Subject: [PATCH] Rename time-equal to time-equal-p
This is for consistency with time-less-p.
* doc/lispref/os.texi (Time Calculations), etc/NEWS:
* src/editfns.c (Ftime_equal_p, syms_of_editfns):
* test/lisp/emacs-lisp/timer-tests.el (timer-test-multiple-of-time):
Rename.
---
doc/lispref/os.texi | 2 +-
etc/NEWS | 2 +-
src/editfns.c | 4 ++--
test/lisp/emacs-lisp/timer-tests.el | 2 +-
4 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/doc/lispref/os.texi b/doc/lispref/os.texi
index 400e6bb45c..8ce5a5ed6d 100644
--- a/doc/lispref/os.texi
+++ b/doc/lispref/os.texi
@@ -1739,7 +1739,7 @@ Time Calculations
The result is @code{nil} if either argument is a NaN.
@end defun
-@defun time-equal t1 t2
+@defun time-equal-p t1 t2
This returns @code{t} if @var{t1} and @var{t2} are equal time values.
The result is @code{nil} if either argument is a NaN.
@end defun
diff --git a/etc/NEWS b/etc/NEWS
index 4dd4260b29..e6508eb60b 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -957,7 +957,7 @@ infinities and NaNs too, and propagate them or return nil like
floating-point operators do.
+++
-** New function 'time-equal' compares time values for equality.
+** New function 'time-equal-p' compares time values for equality.
** define-minor-mode automatically documents the meaning of ARG.
diff --git a/src/editfns.c b/src/editfns.c
index acd80bbf31..daea746387 100644
--- a/src/editfns.c
+++ b/src/editfns.c
@@ -1676,7 +1676,7 @@ See `current-time-string' for the various forms of a time value. */)
return time_cmp (t1, t2) < 0 ? Qt : Qnil;
}
-DEFUN ("time-equal", Ftime_equal, Stime_equal, 2, 2, 0,
+DEFUN ("time-equal-p", Ftime_equal_p, Stime_equal_p, 2, 2, 0,
doc: /* Return non-nil if T1 and T2 are equal time values. */)
(Lisp_Object t1, Lisp_Object t2)
{
@@ -5765,7 +5765,7 @@ it to be non-nil. */);
defsubr (&Scurrent_time);
defsubr (&Stime_add);
defsubr (&Stime_subtract);
- defsubr (&Stime_equal);
+ defsubr (&Stime_equal_p);
defsubr (&Stime_less_p);
defsubr (&Sget_internal_run_time);
defsubr (&Sformat_time_string);
diff --git a/test/lisp/emacs-lisp/timer-tests.el b/test/lisp/emacs-lisp/timer-tests.el
index 0e40cdf442..c5971ee768 100644
--- a/test/lisp/emacs-lisp/timer-tests.el
+++ b/test/lisp/emacs-lisp/timer-tests.el
@@ -40,7 +40,7 @@
(should (debug-timer-check)) t))
(ert-deftest timer-test-multiple-of-time ()
- (should (time-equal
+ (should (time-equal-p
(timer-next-integral-multiple-of-time '(0 0 0 1) (1+ (ash 1 53)))
(list (ash 1 (- 53 16)) 1))))
--
2.17.1
next prev parent reply other threads:[~2018-09-28 17:39 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20180925021527.10418.61555@vcs0.savannah.gnu.org>
[not found] ` <20180925021528.9A119204E8@vcs0.savannah.gnu.org>
2018-09-25 10:09 ` master d0c77a1: Remove some assumptions about timestamp format Michael Albinus
2018-09-26 1:09 ` Paul Eggert
2018-09-26 9:24 ` Michael Albinus
2018-09-26 9:39 ` Eli Zaretskii
2018-09-26 9:43 ` Michael Albinus
2018-09-27 20:46 ` Paul Eggert
2018-09-28 6:32 ` Eli Zaretskii
2018-09-28 10:26 ` Michael Albinus
2018-09-28 17:27 ` Paul Eggert
2018-09-29 13:35 ` Michael Albinus
2018-09-28 14:45 ` Paul Eggert
2018-09-28 14:54 ` Michael Albinus
2018-09-28 1:50 ` Paul Eggert
2018-09-28 10:35 ` Michael Albinus
2018-09-28 17:39 ` Paul Eggert [this message]
2018-09-28 18:06 ` Naming predicates (was: master d0c77a1: Remove some assumptions about timestamp format) Stefan Monnier
2018-09-28 18:28 ` Drew Adams
2018-09-28 19:12 ` Paul Eggert
2018-09-28 19:26 ` Naming predicates Stefan Monnier
2018-09-28 19:40 ` Drew Adams
2018-09-28 19:41 ` Naming predicates (was: master d0c77a1: Remove some assumptions about timestamp format) Drew Adams
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=3356af4b-f6f5-e353-6162-a5fa8880d223@cs.ucla.edu \
--to=eggert@cs.ucla.edu \
--cc=emacs-devel@gnu.org \
--cc=michael.albinus@gmx.de \
/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).