unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Boruch Baum <boruch_baum@gmx.com>
To: Lars Ingebrigtsen <larsi@gnus.org>
Cc: 32105@debbugs.gnu.org, "Edward M. Reingold" <reingold@cs.uiuc.edu>
Subject: bug#32105: 25.2; calendar-read-date should default to today [PATCH INCLUDED]
Date: Mon, 24 Jun 2019 12:52:57 -0400	[thread overview]
Message-ID: <20190624165257.eyivujzaoxebbl2w@E15-2016.optimum.net> (raw)
In-Reply-To: <m3d0j3uhu9.fsf@gnus.org>

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	other threads:[~2019-06-24 16:52 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-07-09 15:53 bug#32105: 25.2; calendar-read-date should default to today [PATCH INCLUDED] Boruch Baum
2019-06-24 15:24 ` Lars Ingebrigtsen
2019-06-24 16:52   ` Boruch Baum [this message]
2019-06-24 20:42     ` Lars Ingebrigtsen
2019-06-25  1:22       ` Boruch Baum
2020-01-20 19:50         ` Stefan Kangas
2020-01-21  4:19           ` Boruch Baum
2020-01-21  5:11             ` Stefan Kangas
2021-01-21  5:41       ` Stefan Monnier

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=20190624165257.eyivujzaoxebbl2w@E15-2016.optimum.net \
    --to=boruch_baum@gmx.com \
    --cc=32105@debbugs.gnu.org \
    --cc=larsi@gnus.org \
    --cc=reingold@cs.uiuc.edu \
    /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).