bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#32105: 25.2; calendar-read-date should default to today [PATCH INCLU


From: Boruch Baum
Subject: bug#32105: 25.2; calendar-read-date should default to today [PATCH INCLUDED]
Date: Mon, 24 Jun 2019 12:52:57 -0400
User-agent: NeoMutt/20180716

On 2019-06-24 17:24, Lars Ingebrigtsen wrote:
> Boruch Baum <boruch_baum@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





reply via email to

[Prev in Thread] Current Thread [Next in Thread]