aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRobert Pluim2022-03-01 15:24:08 +0100
committerRobert Pluim2022-04-05 18:11:05 +0200
commit0e9420bc8ff2a9ff9dc7b3c032f8db1c7cc01b41 (patch)
treee15707321f0bd065d71a9dc8b7e93ec2962c0eec
parente48ac2e2040cf0dd628b7fee6991a1738ceb2349 (diff)
downloademacs-0e9420bc8ff2a9ff9dc7b3c032f8db1c7cc01b41.tar.gz
emacs-0e9420bc8ff2a9ff9dc7b3c032f8db1c7cc01b41.zip
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)
-rw-r--r--lisp/calendar/appt.el10
1 files changed, 7 insertions, 3 deletions
diff --git a/lisp/calendar/appt.el b/lisp/calendar/appt.el
index ebdafb438e3..a7d13cff9a1 100644
--- a/lisp/calendar/appt.el
+++ b/lisp/calendar/appt.el
@@ -510,9 +510,13 @@ The time should be in either 24 hour format or am/pm format.
510Optional argument WARNTIME is an integer (or string) giving the number 510Optional argument WARNTIME is an integer (or string) giving the number
511of minutes before the appointment at which to start warning. 511of minutes before the appointment at which to start warning.
512The default is `appt-message-warning-time'." 512The default is `appt-message-warning-time'."
513 (interactive "sTime (hh:mm[am/pm]): \nsMessage: \n\ 513 (interactive (list (let ((time (read-string "Time (hh:mm[am/pm]): ")))
514sMinutes before the appointment to start warning: ") 514 (unless (string-match-p appt-time-regexp time)
515 (unless (string-match appt-time-regexp time) 515 (user-error "Unacceptable time-string"))
516 time)
517 (read-string "Message: ")
518 (read-string "Minutes before the appointment to start warning: ")))
519 (unless (string-match-p appt-time-regexp time)
516 (user-error "Unacceptable time-string")) 520 (user-error "Unacceptable time-string"))
517 (and (stringp warntime) 521 (and (stringp warntime)
518 (setq warntime (unless (string-equal warntime "") 522 (setq warntime (unless (string-equal warntime "")