Avoid rebuilding a static alist inside a loop

* lisp/calendar/diary-lib.el (diary-mark-entries-1): Build
months-alist outside of the loop.  (Bug#78779)
This commit is contained in:
Manuel Giraud 2025-06-13 11:25:15 +02:00 committed by Eli Zaretskii
parent 60fbeda771
commit d7e5555875

View file

@ -1280,8 +1280,15 @@ function that converts absolute dates to dates of the appropriate type."
(month "[0-9]+\\|\\*")
(day "[0-9]+\\|\\*")
(year "[0-9]+\\|\\*"))
(let* ((case-fold-search t)
marks)
(let ((months-alist (if months (calendar-make-alist months)
(calendar-make-alist
calendar-month-name-array
1 nil calendar-month-abbrev-array
(mapcar (lambda (e)
(format "%s." e))
calendar-month-abbrev-array))))
(case-fold-search t)
marks)
(dolist (date-form diary-date-forms)
(if (eq (car date-form) 'backup) ; ignore 'backup directive
(setq date-form (cdr date-form)))
@ -1363,16 +1370,7 @@ function that converts absolute dates to dates of the appropriate type."
(if mm-name
(setq mm
(if (string-equal mm-name "*") 0
(cdr (assoc-string
mm-name
(if months (calendar-make-alist months)
(calendar-make-alist
calendar-month-name-array
1 nil calendar-month-abbrev-array
(mapcar (lambda (e)
(format "%s." e))
calendar-month-abbrev-array)))
t)))))
(cdr (assoc-string mm-name months-alist t)))))
(funcall markfunc mm dd yy marks)))))))))
;;;###cal-autoload