GNU bug report logs - #32105
25.2; calendar-read-date should default to today

Previous Next

Package: emacs;

Reported by: Boruch Baum <boruch_baum <at> gmx.com>

Date: Mon, 9 Jul 2018 15:55:02 UTC

Severity: wishlist

Found in version 25.2

Done: Stefan Monnier <monnier <at> iro.umontreal.ca>

Bug is archived. No further changes may be made.

Full log


Message #11 received at 32105 <at> debbugs.gnu.org (full text, mbox):

From: Boruch Baum <boruch_baum <at> gmx.com>
To: Lars Ingebrigtsen <larsi <at> gnus.org>
Cc: Glenn Morris <rgm <at> gnu.org>, 32105 <at> debbugs.gnu.org,
 "Edward M. Reingold" <reingold <at> cs.uiuc.edu>
Subject: Re: bug#32105: 25.2; calendar-read-date should default to today
 [PATCH INCLUDED]
Date: Mon, 24 Jun 2019 12:52:57 -0400
On 2019-06-24 17:24, Lars Ingebrigtsen wrote:
> Boruch Baum <boruch_baum <at> gmx.com> writes:
>
> > The behavior of function `calendar-read-date' is inconsistent in that
> > its default is provide the current year, but not the current month or
> > day of the month.
>
> I agree; if we get a default year, then everything should get defaults.
>
> However: The Emacs standard for prompting these days is to put the
> default into `M-n', isn't it?  The current `calendar-read-date'
> requires you to delete the default "2019" if you want another year...

Yes, that's an inconvenience.

> So perhaps that should also be changed, and today's date for all three
> questions should be in `M-n'?

Agreed.

The function is inconsistent in that it uses function `calendar-read'
for the year and day values, but `completing-read' for the month value.
Should `calendar-read' behave like `completing-read'? Maybe it should
have additional optional arguments for everything required by
`completing-read', and then just call `completing-read'? Or just not use
`calendar-read' at all, and deprecate it?

If you `completing-read' -type behavior for entry of the year field, how
many history entries are you going to give the user? You could use
`history-length', like so:

(let* ((n-year (calendar-extract-year (calendar-current-date)))
       (a-year (- n-year (/ history-length 2)))
       (z-year (+ n-year (/ history-length 2))))
  (number-sequence a-year z-year))

This has a disadvantage that for certain use-cases future years might
not make sense.

--
hkp://keys.gnupg.net
CA45 09B5 5351 7C11 A9D1  7286 0036 9E45 1595 8BC0




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

Previous Next


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