unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Maxim Nikulin <m.a.nikulin@gmail.com>
To: Paul Eggert <eggert@cs.ucla.edu>
Cc: Eli Zaretskii <eliz@gnu.org>,
	55635@debbugs.gnu.org, Lars Ingebrigtsen <larsi@gnus.org>
Subject: bug#55635: `make-decoded-time' incorrectly sets DST to nil, it should be -1 (guess)
Date: Tue, 14 Jun 2022 22:57:51 +0700	[thread overview]
Message-ID: <edb946b2-6bb3-9a02-f295-bf374b38388e@gmail.com> (raw)
In-Reply-To: <4ec38916-753e-be93-a08d-a4e7cc4dd86f@cs.ucla.edu>

On 14/06/2022 04:30, Paul Eggert wrote:
> On 5/31/22 05:25, Maxim Nikulin wrote:
> 
>> I have never used `cl-defstruct' before (and frankly speaking I am 
>> rather confused that the `decoded-time' struct and its constructor 
>> `make-decoded-time' are defined in different files and even 
>> directories are not the same), so my question may be naïve. Why did 
>> not you just add this new sentence to the :documentation property of 
>> the DST slot a bit above?
> 
> I am not sure I understand the question. The slot itself has a specified 
> value (t, nil, or -1) whereas the decoded-time-dst function returns an 
> unspecified value when there is no slot.

See the diff at the end of this message. Maybe I do not see any 
difference because I tried such definitions and (describe-function 
`decoded-time-dst), (describe-symbol 'decoded-time) in Emacs-27, not for 
the development version.

>> It may be reasonable to cross-link `decoded-time' and 
>> `make-decoded-time' in docstrings.
> 
> Thanks for the suggestions; I installed the attached.

First of all, I am sorry, for some reason I missed that 
`make-decoded-time' already has "`decoded-time'" in its docstring. Maybe 
I am not familiar with help system enough, but my idea was to add a 
docstring to `cl-defstruct' as a whole (currently only slots are 
documented) that has "`make-decoded-time'" reference in the opposite 
direction to existing one. I admit that I missed something else and it 
is not necessary.

diff --git a/lisp/simple.el b/lisp/simple.el
index 99c951b24b..3054d79d44 100644
--- a/lisp/simple.el
+++ b/lisp/simple.el
@@ -10511,27 +10511,19 @@ This is an integer between 1 and 12 
(inclusive).  January is 1.")
    (year nil :documentation "This is a four digit integer.")
    (weekday nil :documentation "\
  This is a number between 0 and 6, and 0 is Sunday.")
+  ;; decoded-time-dst is problematic on 6-element lists.
+  ;; It should return -1 indicating unknown DST, but currently returns
+  ;; nil indicating standard time.
    (dst -1 :documentation "\
  This is t if daylight saving time is in effect, nil if it is not
  in effect, and -1 if daylight saving information is not available.
-Also see `decoded-time-dst'.")
+As a special case, return an unspecified value when given a list
+too short to have a dst element.")
    (zone nil :documentation "\
  This is an integer indicating the UTC offset in seconds, i.e.,
  the number of seconds east of Greenwich.")
    )

-;; Document that decoded-time-dst is problematic on 6-element lists.
-;; It should return -1 indicating unknown DST, but currently returns
-;; nil indicating standard time.
-(put 'decoded-time-dst 'function-documentation
-     "Access slot \"dst\" of `decoded-time' struct CL-X.
-This is t if daylight saving time is in effect, nil if it is not
-in effect, and -1 if daylight saving information is not available.
-As a special case, return an unspecified value when given a list
-too short to have a dst element.
-
-(fn CL-X)")
-
  (defun get-scratch-buffer-create ()
    "Return the *scratch* buffer, creating a new one if needed."
    (or (get-buffer "*scratch*")





      reply	other threads:[~2022-06-14 15:57 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-25 14:46 bug#55635: `make-decoded-time' incorrectly sets DST to nil, it should be -1 (guess) Maxim Nikulin
2022-05-26 12:13 ` Lars Ingebrigtsen
2022-05-27  2:11   ` Paul Eggert
2022-05-27 10:40     ` Lars Ingebrigtsen
2022-05-27 19:26       ` Paul Eggert
2022-05-28 10:41         ` Lars Ingebrigtsen
2022-05-28 16:31           ` Maxim Nikulin
2022-05-28 16:53             ` Eli Zaretskii
2022-05-28 17:25               ` Paul Eggert
2022-05-29 13:10                 ` Lars Ingebrigtsen
2022-05-29 22:04                   ` Paul Eggert
2022-05-31 12:25                     ` Maxim Nikulin
2022-06-13 21:30                       ` Paul Eggert
2022-06-14 15:57                         ` Maxim Nikulin [this message]

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=edb946b2-6bb3-9a02-f295-bf374b38388e@gmail.com \
    --to=m.a.nikulin@gmail.com \
    --cc=55635@debbugs.gnu.org \
    --cc=eggert@cs.ucla.edu \
    --cc=eliz@gnu.org \
    --cc=larsi@gnus.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.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).