Fix todo-mode item date editing bugs
* lisp/calendar/todo-mode.el (todo-edit-item--header): Prevent out of range error by making sure the value of the numerical month date component cannot be nil. Prevent wrong type error on trying to edit day number in February by making sure numerical instead of string value of the year component is passed to todo-read-date. (todo-read-date): When using the numerical month date component make sure to use `*' for an arbitrary month instead of its numerical value.
This commit is contained in:
parent
1e996cfbd0
commit
1cb126866d
1 changed files with 9 additions and 11 deletions
|
@ -2262,9 +2262,8 @@ made in the number or names of categories."
|
||||||
(mlist (append tmn-array nil))
|
(mlist (append tmn-array nil))
|
||||||
(tma-array todo-month-abbrev-array)
|
(tma-array todo-month-abbrev-array)
|
||||||
(mablist (append tma-array nil))
|
(mablist (append tma-array nil))
|
||||||
(yy (and oyear (unless (string= oyear "*")
|
(yy (and oyear (string-to-number oyear))) ; 0 if year is "*".
|
||||||
(string-to-number oyear))))
|
(mm (or (and omonth (if (string= omonth "*") 13
|
||||||
(mm (or (and omonth (unless (string= omonth "*")
|
|
||||||
(string-to-number omonth)))
|
(string-to-number omonth)))
|
||||||
(1+ (- (length mlist)
|
(1+ (- (length mlist)
|
||||||
(length (or (member omonthname mlist)
|
(length (or (member omonthname mlist)
|
||||||
|
@ -2330,12 +2329,11 @@ made in the number or names of categories."
|
||||||
(if omonth
|
(if omonth
|
||||||
(number-to-string mm)
|
(number-to-string mm)
|
||||||
(aref tma-array (1- mm))))))
|
(aref tma-array (1- mm))))))
|
||||||
(let ((yy (string-to-number year)) ; 0 if year is "*".
|
;; Since the number corresponding to the arbitrary
|
||||||
;; When mm is 13 (corresponding to "*" as value
|
;; month name "*" is out of the range of
|
||||||
;; of month), this raises an args-out-of-range
|
;; calendar-last-day-of-month, set it to 1
|
||||||
;; error in calendar-last-day-of-month, so use 1
|
;; (corresponding to January) to allow 31 days.
|
||||||
;; (corresponding to January) to get 31 days.
|
(let ((mm (if (= mm 13) 1 mm)))
|
||||||
(mm (if (= mm 13) 1 mm)))
|
|
||||||
(if (> (string-to-number day)
|
(if (> (string-to-number day)
|
||||||
(calendar-last-day-of-month mm yy))
|
(calendar-last-day-of-month mm yy))
|
||||||
(user-error "%s %s does not have %s days"
|
(user-error "%s %s does not have %s days"
|
||||||
|
@ -2347,7 +2345,7 @@ made in the number or names of categories."
|
||||||
monthname omonthname
|
monthname omonthname
|
||||||
day (cond
|
day (cond
|
||||||
((not current-prefix-arg)
|
((not current-prefix-arg)
|
||||||
(todo-read-date 'day mm oyear))
|
(todo-read-date 'day mm yy))
|
||||||
((string= oday "*")
|
((string= oday "*")
|
||||||
(user-error "Cannot increment *"))
|
(user-error "Cannot increment *"))
|
||||||
((or (string= omonth "*") (string= omonthname "*"))
|
((or (string= omonth "*") (string= omonthname "*"))
|
||||||
|
@ -5933,7 +5931,7 @@ number of the last the day of the month."
|
||||||
(and day (setq day (if (eq day '*)
|
(and day (setq day (if (eq day '*)
|
||||||
(symbol-name '*)
|
(symbol-name '*)
|
||||||
(number-to-string day))))
|
(number-to-string day))))
|
||||||
(and month (setq month (if (eq month '*)
|
(and month (setq month (if (= month 13)
|
||||||
(symbol-name '*)
|
(symbol-name '*)
|
||||||
(number-to-string month))))
|
(number-to-string month))))
|
||||||
(if arg
|
(if arg
|
||||||
|
|
Loading…
Add table
Reference in a new issue