* lisp/calendar/todo-mode.el: Use calendar-dlet*
(dayname, monthname, day, month, year): Don't declare globally. (todo-date-pattern, todo-edit-item--header) (todo-convert-legacy-date-time, todo-read-date): Use calendar-dlet* around uses of calendar-date-display-form.
This commit is contained in:
parent
512f81407c
commit
ad039f9bcc
1 changed files with 28 additions and 27 deletions
|
@ -188,25 +188,17 @@ The final element is \"*\", indicating an unspecified month.")
|
|||
"Array of abbreviated month names, in order.
|
||||
The final element is \"*\", indicating an unspecified month.")
|
||||
|
||||
(with-no-warnings
|
||||
;; FIXME: These vars lack a prefix, but this is out of our control, because
|
||||
;; they're defined by Calendar, e.g. for calendar-date-display-form.
|
||||
(defvar dayname)
|
||||
(defvar monthname)
|
||||
(defvar day)
|
||||
(defvar month)
|
||||
(defvar year))
|
||||
|
||||
(defconst todo-date-pattern
|
||||
(let ((dayname (diary-name-pattern calendar-day-name-array nil t)))
|
||||
(concat "\\(?4:\\(?5:" dayname "\\)\\|"
|
||||
(let ((dayname)
|
||||
(monthname (format "\\(?6:%s\\)" (diary-name-pattern
|
||||
todo-month-name-array
|
||||
todo-month-abbrev-array)))
|
||||
(month "\\(?7:[0-9]+\\|\\*\\)")
|
||||
(day "\\(?8:[0-9]+\\|\\*\\)")
|
||||
(year "-?\\(?9:[0-9]+\\|\\*\\)"))
|
||||
(calendar-dlet*
|
||||
((dayname)
|
||||
(monthname (format "\\(?6:%s\\)" (diary-name-pattern
|
||||
todo-month-name-array
|
||||
todo-month-abbrev-array)))
|
||||
(month "\\(?7:[0-9]+\\|\\*\\)")
|
||||
(day "\\(?8:[0-9]+\\|\\*\\)")
|
||||
(year "-?\\(?9:[0-9]+\\|\\*\\)"))
|
||||
(mapconcat #'eval calendar-date-display-form ""))
|
||||
"\\)"))
|
||||
"Regular expression matching a todo item date header.")
|
||||
|
@ -2274,8 +2266,8 @@ made in the number or names of categories."
|
|||
;; `todo-edit-item' as e.g. `-' or `C-u'.
|
||||
(inc (prefix-numeric-value inc))
|
||||
(buffer-read-only nil)
|
||||
ndate ntime year monthname month day
|
||||
dayname) ; Needed by calendar-date-display-form.
|
||||
ndate ntime
|
||||
year monthname month day dayname)
|
||||
(when marked (todo--user-error-if-marked-done-item))
|
||||
(save-excursion
|
||||
(or (and marked (goto-char (point-min))) (todo-item-start))
|
||||
|
@ -2416,7 +2408,15 @@ made in the number or names of categories."
|
|||
;; If year, month or day date string components were
|
||||
;; changed, rebuild the date string.
|
||||
(when (memq what '(year month day))
|
||||
(setq ndate (mapconcat #'eval calendar-date-display-form ""))))
|
||||
(setq ndate
|
||||
(calendar-dlet*
|
||||
;; Needed by calendar-date-display-form.
|
||||
((year year)
|
||||
(monthname monthname)
|
||||
(month month)
|
||||
(day day)
|
||||
(dayname dayname))
|
||||
(mapconcat #'eval calendar-date-display-form "")))))
|
||||
(when ndate (replace-match ndate nil nil nil 1))
|
||||
;; Add new time string to the header, if it was supplied.
|
||||
(when ntime
|
||||
|
@ -4613,12 +4613,13 @@ strings built using the default value of
|
|||
(defun todo-convert-legacy-date-time ()
|
||||
"Return converted date-time string.
|
||||
Helper function for `todo-convert-legacy-files'."
|
||||
(let* ((year (match-string 1))
|
||||
(month (match-string 2))
|
||||
(monthname (calendar-month-name (string-to-number month) t))
|
||||
(day (match-string 3))
|
||||
(time (match-string 4))
|
||||
dayname)
|
||||
(calendar-dlet*
|
||||
((year (match-string 1))
|
||||
(month (match-string 2))
|
||||
(monthname (calendar-month-name (string-to-number month) t))
|
||||
(day (match-string 3))
|
||||
(time (match-string 4))
|
||||
dayname)
|
||||
(replace-match "")
|
||||
(insert (mapconcat #'eval calendar-date-display-form "")
|
||||
(when time (concat " " time)))))
|
||||
|
@ -5990,8 +5991,8 @@ indicating an unspecified month, day, or year.
|
|||
|
||||
When ARG is `day', non-nil arguments MO and YR determine the
|
||||
number of the last the day of the month."
|
||||
(let (year monthname month day
|
||||
dayname) ; Needed by calendar-date-display-form.
|
||||
(calendar-dlet*
|
||||
(year monthname month day dayname) ;Needed by calendar-date-display-form.
|
||||
(when (or (not arg) (eq arg 'year))
|
||||
(while (if (natnump year) (< year 1) (not (eq year '*)))
|
||||
(setq year (read-from-minibuffer
|
||||
|
|
Loading…
Add table
Reference in a new issue