all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Boruch Baum <boruch_baum@gmx.com>
To: 32105@debbugs.gnu.org
Cc: "Edward M. Reingold" <reingold@cs.uiuc.edu>
Subject: bug#32105: 25.2; calendar-read-date should default to today [PATCH INCLUDED]
Date: Mon, 9 Jul 2018 11:53:44 -0400	[thread overview]
Message-ID: <20180709155344.cnpbkeb6dcryld44@E15-2016.optimum.net> (raw)

[-- Attachment #1: Type: text/plain, Size: 1781 bytes --]


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.

Patch attached.


In GNU Emacs 25.2.2 (x86_64-pc-linux-gnu, GTK+ Version 3.22.30)
 of 2018-05-07, modified by Debian built on binet
System Description:	Devuan GNU/Linux 2.0.0 (ascii)

Configured using:
 'configure --build x86_64-linux-gnu --prefix=/usr
 --sharedstatedir=/var/lib --libexecdir=/usr/lib
 --localstatedir=/var/lib --infodir=/usr/share/info
 --mandir=/usr/share/man --with-pop=yes
 --enable-locallisppath=/etc/emacs25:/etc/emacs:/usr/local/share/emacs/25.2/site-lisp:/usr/local/share/emacs/site-lisp:/usr/share/emacs/25.2/site-lisp:/usr/share/emacs/site-lisp
 --with-sound=alsa --without-gconf --build x86_64-linux-gnu
 --prefix=/usr --sharedstatedir=/var/lib --libexecdir=/usr/lib
 --localstatedir=/var/lib --infodir=/usr/share/info
 --mandir=/usr/share/man --with-pop=yes
 --enable-locallisppath=/etc/emacs25:/etc/emacs:/usr/local/share/emacs/25.2/site-lisp:/usr/local/share/emacs/site-lisp:/usr/share/emacs/25.2/site-lisp:/usr/share/emacs/site-lisp
 --with-sound=alsa --without-gconf --with-x=yes --with-x-toolkit=gtk3
 --with-toolkit-scroll-bars 'CFLAGS=-g -O2
 -fdebug-prefix-map=/build/emacs25-NE1ko4/emacs25-25.2+1=.
 -fstack-protector-strong -Wformat -Werror=format-security -Wall'
 'CPPFLAGS=-Wdate-time -D_FORTIFY_SOURCE=2' LDFLAGS=-Wl,-z,relro'

Configured features:
XPM JPEG TIFF GIF PNG RSVG IMAGEMAGICK SOUND GPM DBUS GSETTINGS NOTIFY
ACL LIBSELINUX GNUTLS LIBXML2 FREETYPE M17N_FLT LIBOTF XFT ZLIB
TOOLKIT_SCROLL_BARS GTK3 X11

Important settings:
  value of $LANG: en_US.UTF-8
  locale-coding-system: utf-8-unix




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

[-- Attachment #2: calendar-read-date.patch --]
[-- Type: text/x-diff, Size: 1598 bytes --]

--- a.el	2018-07-09 11:50:31.882699070 -0400
+++ b.el	2018-07-09 11:51:07.636744090 -0400
@@ -2243,18 +2243,19 @@
 If optional NODAY is t, does not ask for day, but just returns
 \(month 1 year); if NODAY is any other non-nil value the value returned is
 \(month year)"
-  (let* ((year (calendar-read
+  (let* ((today (calendar-current-date))
+         (year (calendar-read
                 "Year (>0): "
                 (lambda (x) (> x 0))
-                (number-to-string (calendar-extract-year
-                                (calendar-current-date)))))
+                (number-to-string (calendar-extract-year today))))
          (month-array calendar-month-name-array)
          (completion-ignore-case t)
          (month (cdr (assoc-string
                        (completing-read
                         "Month name: "
                         (mapcar 'list (append month-array nil))
-                        nil t)
+                        nil t nil nil
+                        (aref month-array (1- (calendar-extract-month today))))
                       (calendar-make-alist month-array 1) t)))
          (last (calendar-last-day-of-month month year)))
     (if noday
@@ -2263,7 +2264,8 @@
           (list month year))
       (list month
             (calendar-read (format "Day (1-%d): " last)
-                           (lambda (x) (and (< 0 x) (<= x last))))
+                           (lambda (x) (and (< 0 x) (<= x last)))
+                           (number-to-string (calendar-extract-day today)))
             year))))
 
 (defun calendar-interval (mon1 yr1 mon2 yr2)

             reply	other threads:[~2018-07-09 15:53 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-07-09 15:53 Boruch Baum [this message]
2019-06-24 15:24 ` bug#32105: 25.2; calendar-read-date should default to today [PATCH INCLUDED] Lars Ingebrigtsen
2019-06-24 16:52   ` Boruch Baum
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

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180709155344.cnpbkeb6dcryld44@E15-2016.optimum.net \
    --to=boruch_baum@gmx.com \
    --cc=32105@debbugs.gnu.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 external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.