1
0
mirror of https://git.savannah.gnu.org/git/emacs.git synced 2025-01-23 18:47:57 +00:00

Reject invalid time-string in appt-add immediately

* lisp/calendar/appt.el (appt-add): Check the provided time-string for
validity immediately after reading it rather than after reading all
the parameters.  (Bug#54210)
This commit is contained in:
Robert Pluim 2022-03-01 15:24:08 +01:00
parent e48ac2e204
commit 0e9420bc8f

View File

@ -510,9 +510,13 @@ The time should be in either 24 hour format or am/pm format.
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)
(interactive (list (let ((time (read-string "Time (hh:mm[am/pm]): ")))
(unless (string-match-p appt-time-regexp time)
(user-error "Unacceptable time-string"))
time)
(read-string "Message: ")
(read-string "Minutes before the appointment to start warning: ")))
(unless (string-match-p appt-time-regexp time)
(user-error "Unacceptable time-string"))
(and (stringp warntime)
(setq warntime (unless (string-equal warntime "")