GNU bug report logs -
#54210
27.1; appt-add checks for bad data only at end
Previous Next
Reported by: Francesco Potortì <pot <at> potorti.it>
Date: Tue, 1 Mar 2022 13:50:02 UTC
Severity: normal
Tags: fixed
Found in version 27.1
Fixed in version 29.1
Done: Robert Pluim <rpluim <at> gmail.com>
Bug is archived. No further changes may be made.
To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 54210 in the body.
You can then email your comments to 54210 AT debbugs.gnu.org in the normal way.
Toggle the display of automated, internal messages from the tracker.
Report forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#54210
; Package
emacs
.
(Tue, 01 Mar 2022 13:50:02 GMT)
Full text and
rfc822 format available.
Acknowledgement sent
to
Francesco Potortì <pot <at> potorti.it>
:
New bug report received and forwarded. Copy sent to
bug-gnu-emacs <at> gnu.org
.
(Tue, 01 Mar 2022 13:50:02 GMT)
Full text and
rfc822 format available.
Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
appt-add asks the user for three parameters:
- time (a time string)
- message (a string)
- minutes (a number)
if the time string is badly formatted (for example if it is "8" rather than "8.00") appt-add barfs. That's ok, but it barfs only after all three parameters have been read. It should barf immediately after submitting the wrong parameter.
Maybe I'll find the time to look at it and propose a patch, but since I don't know, I prefer reporting it now.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#54210
; Package
emacs
.
(Tue, 01 Mar 2022 14:23:01 GMT)
Full text and
rfc822 format available.
Message #8 received at 54210 <at> debbugs.gnu.org (full text, mbox):
>>>>> On Tue, 01 Mar 2022 13:54:47 +0100, Francesco Potortì <pot <at> potorti.it> 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))))
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#54210
; Package
emacs
.
(Tue, 01 Mar 2022 14:41:02 GMT)
Full text and
rfc822 format available.
Message #11 received at 54210 <at> debbugs.gnu.org (full text, mbox):
>>>>> On Tue, 01 Mar 2022 15:31:32 +0100, Francesco Potortì <pot <at> potorti.it> said:
Francesco> It works for me!
OK, Iʼll queue it up (although Iʼm running at about one push a week at
the moment, so donʼt hold your breath).
Robert
--
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#54210
; Package
emacs
.
(Tue, 01 Mar 2022 15:51:02 GMT)
Full text and
rfc822 format available.
Message #14 received at 54210 <at> debbugs.gnu.org (full text, mbox):
>>>>>> On Tue, 01 Mar 2022 13:54:47 +0100, Francesco Potortì <pot <at> potorti.it> 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!
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#54210
; Package
emacs
.
(Fri, 04 Mar 2022 00:00:02 GMT)
Full text and
rfc822 format available.
Message #17 received at 54210 <at> debbugs.gnu.org (full text, mbox):
Robert Pluim <rpluim <at> gmail.com> writes:
> How about this (I canʼt find a `read-time-of-day', unless org has one hidden
> away somewhere):
Doesn't look wrong to me.
> + (unless (string-match appt-time-regexp time)
> + (user-error "Unacceptable time-string"))
I know you just more or less copied that code from the body, but I think
this can be made a `string-match-p' test. I think that code is just
older than the existence of `string-match-p'.
Michael.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#54210
; Package
emacs
.
(Tue, 05 Apr 2022 16:12:02 GMT)
Full text and
rfc822 format available.
Message #20 received at 54210 <at> debbugs.gnu.org (full text, mbox):
tags 54210 fixed
close 54210 29.1
quit
>>>>> On Tue, 01 Mar 2022 15:40:45 +0100, Robert Pluim <rpluim <at> gmail.com> said:
>>>>> On Tue, 01 Mar 2022 15:31:32 +0100, Francesco Potortì <pot <at> potorti.it> said:
Francesco> It works for me!
Robert> OK, Iʼll queue it up (although Iʼm running at about one push a week at
Robert> the moment, so donʼt hold your breath).
Closing.
Committed as 0e9420bc8f
Added tag(s) fixed.
Request was from
Robert Pluim <rpluim <at> gmail.com>
to
control <at> debbugs.gnu.org
.
(Tue, 05 Apr 2022 16:12:03 GMT)
Full text and
rfc822 format available.
bug marked as fixed in version 29.1, send any further explanations to
54210 <at> debbugs.gnu.org and Francesco Potortì <pot <at> potorti.it>
Request was from
Robert Pluim <rpluim <at> gmail.com>
to
control <at> debbugs.gnu.org
.
(Tue, 05 Apr 2022 16:12:03 GMT)
Full text and
rfc822 format available.
bug archived.
Request was from
Debbugs Internal Request <help-debbugs <at> gnu.org>
to
internal_control <at> debbugs.gnu.org
.
(Wed, 04 May 2022 11:24:05 GMT)
Full text and
rfc822 format available.
This bug report was last modified 3 years and 41 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.