* bug#54210: 27.1; appt-add checks for bad data only at end
@ 2022-03-01 12:54 Francesco Potortì
2022-03-01 14:21 ` Robert Pluim
0 siblings, 1 reply; 6+ messages in thread
From: Francesco Potortì @ 2022-03-01 12:54 UTC (permalink / raw)
To: 54210
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.
^ permalink raw reply [flat|nested] 6+ messages in thread
* bug#54210: 27.1; appt-add checks for bad data only at end
2022-03-01 12:54 bug#54210: 27.1; appt-add checks for bad data only at end Francesco Potortì
@ 2022-03-01 14:21 ` Robert Pluim
2022-03-01 14:31 ` Francesco Potortì
2022-03-03 23:59 ` Michael Heerdegen
0 siblings, 2 replies; 6+ messages in thread
From: Robert Pluim @ 2022-03-01 14:21 UTC (permalink / raw)
To: Francesco Potortì; +Cc: 54210
>>>>> On Tue, 01 Mar 2022 13:54:47 +0100, Francesco Potortì <pot@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))))
^ permalink raw reply related [flat|nested] 6+ messages in thread
* bug#54210: 27.1; appt-add checks for bad data only at end
2022-03-01 14:21 ` Robert Pluim
@ 2022-03-01 14:31 ` Francesco Potortì
2022-03-01 14:40 ` Robert Pluim
2022-03-03 23:59 ` Michael Heerdegen
1 sibling, 1 reply; 6+ messages in thread
From: Francesco Potortì @ 2022-03-01 14:31 UTC (permalink / raw)
To: Robert Pluim; +Cc: 54210
>>>>>> On Tue, 01 Mar 2022 13:54:47 +0100, Francesco Potortì <pot@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!
^ permalink raw reply [flat|nested] 6+ messages in thread
* bug#54210: 27.1; appt-add checks for bad data only at end
2022-03-01 14:31 ` Francesco Potortì
@ 2022-03-01 14:40 ` Robert Pluim
2022-04-05 16:11 ` Robert Pluim
0 siblings, 1 reply; 6+ messages in thread
From: Robert Pluim @ 2022-03-01 14:40 UTC (permalink / raw)
To: Francesco Potortì; +Cc: 54210
>>>>> On Tue, 01 Mar 2022 15:31:32 +0100, Francesco Potortì <pot@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
--
^ permalink raw reply [flat|nested] 6+ messages in thread
* bug#54210: 27.1; appt-add checks for bad data only at end
2022-03-01 14:21 ` Robert Pluim
2022-03-01 14:31 ` Francesco Potortì
@ 2022-03-03 23:59 ` Michael Heerdegen
1 sibling, 0 replies; 6+ messages in thread
From: Michael Heerdegen @ 2022-03-03 23:59 UTC (permalink / raw)
To: Robert Pluim; +Cc: Francesco Potortì, 54210
Robert Pluim <rpluim@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.
^ permalink raw reply [flat|nested] 6+ messages in thread
* bug#54210: 27.1; appt-add checks for bad data only at end
2022-03-01 14:40 ` Robert Pluim
@ 2022-04-05 16:11 ` Robert Pluim
0 siblings, 0 replies; 6+ messages in thread
From: Robert Pluim @ 2022-04-05 16:11 UTC (permalink / raw)
To: Francesco Potortì; +Cc: 54210
tags 54210 fixed
close 54210 29.1
quit
>>>>> On Tue, 01 Mar 2022 15:40:45 +0100, Robert Pluim <rpluim@gmail.com> said:
>>>>> On Tue, 01 Mar 2022 15:31:32 +0100, Francesco Potortì <pot@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
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2022-04-05 16:11 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-03-01 12:54 bug#54210: 27.1; appt-add checks for bad data only at end Francesco Potortì
2022-03-01 14:21 ` Robert Pluim
2022-03-01 14:31 ` Francesco Potortì
2022-03-01 14:40 ` Robert Pluim
2022-04-05 16:11 ` Robert Pluim
2022-03-03 23:59 ` Michael Heerdegen
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.