From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Francesco =?UTF-8?Q?Potort=C3=AC?= Newsgroups: gmane.emacs.bugs Subject: bug#54210: 27.1; appt-add checks for bad data only at end Date: Tue, 01 Mar 2022 15:31:32 +0100 Message-ID: References: <87v8wxiwhm.fsf@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="38549"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 54210@debbugs.gnu.org To: Robert Pluim Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Tue Mar 01 16:51:13 2022 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 1nP4mO-0009qT-Rh for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 01 Mar 2022 16:51:12 +0100 Original-Received: from localhost ([::1]:47276 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nP4mN-0001vq-KQ for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 01 Mar 2022 10:51:11 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:44098) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nP4mF-0001v9-81 for bug-gnu-emacs@gnu.org; Tue, 01 Mar 2022 10:51:03 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]:44167) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nP4mE-0004kp-VZ for bug-gnu-emacs@gnu.org; Tue, 01 Mar 2022 10:51:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1nP4mE-0006fK-Ub for bug-gnu-emacs@gnu.org; Tue, 01 Mar 2022 10:51:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Francesco =?UTF-8?Q?Potort=C3=AC?= Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 01 Mar 2022 15:51:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 54210 X-GNU-PR-Package: emacs Original-Received: via spool by 54210-submit@debbugs.gnu.org id=B54210.164614985025589 (code B ref 54210); Tue, 01 Mar 2022 15:51:02 +0000 Original-Received: (at 54210) by debbugs.gnu.org; 1 Mar 2022 15:50:50 +0000 Original-Received: from localhost ([127.0.0.1]:38062 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nP4m1-0006ee-Jw for submit@debbugs.gnu.org; Tue, 01 Mar 2022 10:50:50 -0500 Original-Received: from plesklin7.if1.ehiweb.it ([79.98.45.16]:42833) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nP3XM-0003pu-Py for 54210@debbugs.gnu.org; Tue, 01 Mar 2022 09:31:37 -0500 Original-Received: from tucano.isti.cnr.it (tucano.isti.cnr.it [146.48.81.102]) by plesklin7.if1.ehiweb.it (Postfix) with ESMTPSA id 0A362104445; Tue, 1 Mar 2022 15:31:33 +0100 (CET) Original-Received: from pot by tucano.isti.cnr.it with local (Exim 4.95) (envelope-from ) id 1nP3XI-00GeXp-Qw; Tue, 01 Mar 2022 15:31:32 +0100 In-Reply-To: <87v8wxiwhm.fsf@gmail.com> (rpluim@gmail.com) X-fingerprint: 4B02 6187 5C03 D6B1 2E31 7666 09DF 2DC9 BE21 6115 X-PPP-Message-ID: <20220301143133.32138.63763@plesklin7.if1.ehiweb.it> X-PPP-Vhost: potorti.it X-Mailman-Approved-At: Tue, 01 Mar 2022 10:50:48 -0500 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:227879 Archived-At: >>>>>> On Tue, 01 Mar 2022 13:54:47 +0100, Francesco Potortì said: > Francesco> appt-add asks the user for three parameters: > Francesco> - time (a time string) > Francesco> - message (a string) > Francesco> - minutes (a number) > > Francesco> if the time string is badly formatted (for example if it is "8" rather > Francesco> than "8.00") appt-add barfs. That's ok, but it barfs only after all > Francesco> three parameters have been read. It should barf immediately after > Francesco> submitting the wrong parameter. > > Francesco> Maybe I'll find the time to look at it and propose a patch, but since > Francesco> I don't know, I prefer reporting it now. > >Aha, a learning opportunity (for me :-) ) > >How about this (I canʼt find a `read-time-of-day', unless org has one hidden >away somewhere): > >diff --git a/lisp/calendar/appt.el b/lisp/calendar/appt.el >index ebdafb438e..6a3ea7c356 100644 >--- a/lisp/calendar/appt.el >+++ b/lisp/calendar/appt.el >@@ -510,10 +510,12 @@ appt-add > Optional argument WARNTIME is an integer (or string) giving the number > of minutes before the appointment at which to start warning. > The default is `appt-message-warning-time'." >- (interactive "sTime (hh:mm[am/pm]): \nsMessage: \n\ >-sMinutes before the appointment to start warning: ") >- (unless (string-match appt-time-regexp time) >- (user-error "Unacceptable time-string")) >+ (interactive (list (let ((time (read-string "Time (hh:mm[am/pm]): "))) >+ (unless (string-match appt-time-regexp time) >+ (user-error "Unacceptable time-string")) >+ time) >+ (read-string "Message: ") >+ (read-string "Minutes before the appointment to start warning: "))) > (and (stringp warntime) > (setq warntime (unless (string-equal warntime "") > (string-to-number warntime)))) > It works for me!