emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

master 0e9420bc8f: Reject invalid time-string in appt-add immediately


From: Robert Pluim
Subject: master 0e9420bc8f: Reject invalid time-string in appt-add immediately
Date: Tue, 5 Apr 2022 12:11:17 -0400 (EDT)

branch: master
commit 0e9420bc8ff2a9ff9dc7b3c032f8db1c7cc01b41
Author: Robert Pluim <rpluim@gmail.com>
Commit: Robert Pluim <rpluim@gmail.com>

    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)
---
 lisp/calendar/appt.el | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/lisp/calendar/appt.el b/lisp/calendar/appt.el
index ebdafb438e..a7d13cff9a 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.
 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 "")



reply via email to

[Prev in Thread] Current Thread [Next in Thread]