From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.bugs Subject: bug#32105: 25.2; calendar-read-date should default to today [PATCH INCLUDED] Date: Thu, 21 Jan 2021 00:41:57 -0500 Message-ID: References: <20180709155344.cnpbkeb6dcryld44@E15-2016.optimum.net> <20190624165257.eyivujzaoxebbl2w@E15-2016.optimum.net> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="15672"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) Cc: Glenn Morris , 32105-done@debbugs.gnu.org, "Edward M. Reingold" , Boruch Baum To: Lars Ingebrigtsen Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Thu Jan 21 06:43:12 2021 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1l2SkR-0003yc-I9 for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 21 Jan 2021 06:43:11 +0100 Original-Received: from localhost ([::1]:40962 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1l2SkQ-0001sN-2z for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 21 Jan 2021 00:43:10 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:37964) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1l2SkI-0001qz-Sk for bug-gnu-emacs@gnu.org; Thu, 21 Jan 2021 00:43:02 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]:45109) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1l2SkI-0008Cr-LW for bug-gnu-emacs@gnu.org; Thu, 21 Jan 2021 00:43:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1l2SkI-0005xQ-Ij for bug-gnu-emacs@gnu.org; Thu, 21 Jan 2021 00:43:02 -0500 In-Reply-To: <20180709155344.cnpbkeb6dcryld44@E15-2016.optimum.net> Resent-From: Stefan Monnier Original-Sender: "Debbugs-submit" Resent-To: bug-gnu-emacs@gnu.org Resent-Date: Thu, 21 Jan 2021 05:43:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: cc-closed 32105 X-GNU-PR-Package: emacs Mail-Followup-To: 32105@debbugs.gnu.org, monnier@iro.umontreal.ca, boruch_baum@gmx.com Original-Received: via spool by 32105-done@debbugs.gnu.org id=D32105.161120772722833 (code D ref 32105); Thu, 21 Jan 2021 05:43:02 +0000 Original-Received: (at 32105-done) by debbugs.gnu.org; 21 Jan 2021 05:42:07 +0000 Original-Received: from localhost ([127.0.0.1]:56653 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1l2SjO-0005wD-VL for submit@debbugs.gnu.org; Thu, 21 Jan 2021 00:42:07 -0500 Original-Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:28400) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1l2SjN-0005vk-NE for 32105-done@debbugs.gnu.org; Thu, 21 Jan 2021 00:42:06 -0500 Original-Received: from pmg3.iro.umontreal.ca (localhost [127.0.0.1]) by pmg3.iro.umontreal.ca (Proxmox) with ESMTP id 4AB334401A0; Thu, 21 Jan 2021 00:42:00 -0500 (EST) Original-Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1]) by pmg3.iro.umontreal.ca (Proxmox) with ESMTP id CBF8344013F; Thu, 21 Jan 2021 00:41:58 -0500 (EST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca; s=mail; t=1611207718; bh=ivp1Tm4/Uk4vISL0BS6EnH+BgQ/38tai0FW8yZzpSDM=; h=From:To:Cc:Subject:References:Date:From; b=EA62jVdutRfY/Mou81g4F6Cj3A27rna60P+iANo2SDhV06KnxDfR72CRTzSdCOSVZ wzhJUSbrgRy/dnukkq5b905APNSI4NX/yOdQoLWpy2dAuaNCCL15gWkOLxSNBwQsyT JRi9UJWNNoyPnlhQTBDsLaiIn6mCcCAmKys6Xnm8ohdVjyEjKs8Y8FZR/HfmEhCQKc 7Qh9HkwV/0Eo0pmdP0WFJirg5qB+8qBs4BXMopdJgaAhfVywKNMnYKQKQA1s+9LHfS SiUuJneUPWt61qQqJIbcYJ6MCi15Pc43Ewhwyc/w7d+jrkS280dB2N9+Z0xi8wZGcW AByyFBuxe9WZg== Original-Received: from alfajor (unknown [45.72.224.181]) by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id 8F94912023F; Thu, 21 Jan 2021 00:41:58 -0500 (EST) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:198308 Archived-At: I just pushed a patch which makes `calendar-read-date` default to today for both the month and day of month, and it makes it use the `M-n` instead of a non--empty minibuffer for the year as well. Stefan Lars Ingebrigtsen [2019-06-24 22:42:31] wrote: > Boruch Baum writes: > >> 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? > > Hm... well, calendar-read seems nice, since it validates the numbers... > >> 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. > > I think just putting the current year in M-n is fine -- we don't have to > mess with the history at all. > > That is, something conceptually like: > > (read-from-minibuffer "Year: " nil nil t nil "2019") > > Then 2019 is in M-n and can be edited, and just hitting RET will also > return 2019.