From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Robert Pluim Newsgroups: gmane.emacs.bugs Subject: bug#54210: 27.1; appt-add checks for bad data only at end Date: Tue, 01 Mar 2022 15:21:57 +0100 Message-ID: <87v8wxiwhm.fsf@gmail.com> References: Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="11909"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 54210@debbugs.gnu.org To: Francesco =?UTF-8?Q?Potort=C3=AC?= Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Tue Mar 01 15:29:07 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 1nP3Uw-0002oK-UZ for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 01 Mar 2022 15:29:06 +0100 Original-Received: from localhost ([::1]:32958 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nP3Uw-0004h6-1d for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 01 Mar 2022 09:29:06 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:40876) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nP3P4-0003B5-I5 for bug-gnu-emacs@gnu.org; Tue, 01 Mar 2022 09:23:02 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]:42014) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nP3P4-0007SX-9C for bug-gnu-emacs@gnu.org; Tue, 01 Mar 2022 09:23:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1nP3P4-0003dg-03 for bug-gnu-emacs@gnu.org; Tue, 01 Mar 2022 09:23:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Robert Pluim Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 01 Mar 2022 14:23:01 +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.164614452713915 (code B ref 54210); Tue, 01 Mar 2022 14:23:01 +0000 Original-Received: (at 54210) by debbugs.gnu.org; 1 Mar 2022 14:22:07 +0000 Original-Received: from localhost ([127.0.0.1]:35911 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nP3OB-0003cM-9O for submit@debbugs.gnu.org; Tue, 01 Mar 2022 09:22:07 -0500 Original-Received: from mail-wr1-f52.google.com ([209.85.221.52]:45024) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nP3O9-0003bq-9N for 54210@debbugs.gnu.org; Tue, 01 Mar 2022 09:22:05 -0500 Original-Received: by mail-wr1-f52.google.com with SMTP id u1so20747643wrg.11 for <54210@debbugs.gnu.org>; Tue, 01 Mar 2022 06:22:05 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:references:date:in-reply-to:message-id :mime-version:content-transfer-encoding; bh=u5q7y1HGNzC6EVPjoMo1LIObaqGd/WBsZVHpo2R6jQc=; b=o2mEoHKSl6NY1ZJc/3mFPfjX8+DsgKh/RcQG62PbRviemZ1AB6bgeN5unYYj6/oT7q fd9oRoiKi9QPxaKPCIfc6X9FHPep6CwBpHAlZA1S/4Fg1TrwSnpQkdPVBWOlhsXVKCoi +QLLqGf20gKlrZLrgB21I3Pmi5iiV80JL+l6O1wZeq7ti9t44mG6drEh5GkRfwT+Oy3B N1GiuiGyMCxosCcwvn4U/0yGpARSCLy78acUEqHh2d5YOBDRLy9/LPI/DZAGRqwLM9w/ L7Dfuejf2PcO6Y38ef+0vlVGyobjgzCCJjbiGWCWRdpNMTi0kujbADdbPAJey4r8gWnQ 7h3Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:references:date:in-reply-to :message-id:mime-version:content-transfer-encoding; bh=u5q7y1HGNzC6EVPjoMo1LIObaqGd/WBsZVHpo2R6jQc=; b=zKivARcijNOSGPxfIOCA6mbKxmQ8HvmoiqNYuZQpvfmtrST1ONKUzp5/JMhDIb8Q4v B/bRf0/2/IvYrXf22f5zIYhe1LGWBu2ZSVPiOtwXHvsJQ+sdIQK6Jiw02XbDz/Cz2JqF trvVjwtbt6YjgEMBqTrNzdemyCJn5QH2MEh2ihdbSNRFBdHmzpW4ngcaxd2yG9RCk/F9 gI+s9aELOv9keyWkhePEX13j4hMi6ZhGpS+zEogZ8uNwebnjHdaCs5h1IZfTtN/xdckm 0ltg9tPqA79d6asBKOvD0wnOEbM2tyyqEdT9LLe7iA1CU5o8+0X2SU054CLgAomZfKzo S/Lg== X-Gm-Message-State: AOAM531EyjfiuHZy/weOP+KMT6kaeOB7CS7B0NXqgaPRPXegbESF2yvI G1BhbMoS7GOrqgv3jZyq99FPW3S7I+0= X-Google-Smtp-Source: ABdhPJxR+doC10lv3IYrIfGPzHExHcZK6res1YAbUyg1XTay2uM+WdK6OQh/HQtBaJM0VpTERSUTaQ== X-Received: by 2002:adf:db82:0:b0:1ed:bf4b:e327 with SMTP id u2-20020adfdb82000000b001edbf4be327mr19598627wri.527.1646144519063; Tue, 01 Mar 2022 06:21:59 -0800 (PST) Original-Received: from rltb ([2a01:e0a:3f3:fb50:70ae:2afb:87fc:d65c]) by smtp.gmail.com with ESMTPSA id b9-20020a5d45c9000000b001ef9200b856sm9377473wrs.115.2022.03.01.06.21.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 01 Mar 2022 06:21:58 -0800 (PST) In-Reply-To: ("Francesco =?UTF-8?Q?Potort=C3=AC?="'s message of "Tue, 01 Mar 2022 13:54:47 +0100") 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:227865 Archived-At: >>>>> On Tue, 01 Mar 2022 13:54:47 +0100, Francesco Potort=C3=AC 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 a= fter 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=CA=BCt 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))))