Commit 9e46548e authored by Glenn Morris's avatar Glenn Morris

(diary-list-entries, (mark-calendar-date-pattern): Use `dotimes'

rather than `calendar-for-loop'.
parent 2ed4b0e2
...@@ -461,95 +461,94 @@ If LIST-ONLY is non-nil don't modify or display the buffer, only return a list." ...@@ -461,95 +461,94 @@ If LIST-ONLY is non-nil don't modify or display the buffer, only return a list."
(set (make-local-variable 'diary-selective-display) t) (set (make-local-variable 'diary-selective-display) t)
(overlay-put ol 'invisible 'diary) (overlay-put ol 'invisible 'diary)
(overlay-put ol 'evaporate t))) (overlay-put ol 'evaporate t)))
(calendar-for-loop (dotimes (idummy number)
i from 1 to number do (let ((month (extract-calendar-month date))
(let ((month (extract-calendar-month date)) (day (extract-calendar-day date))
(day (extract-calendar-day date)) (year (extract-calendar-year date))
(year (extract-calendar-year date)) (entry-found (list-sexp-diary-entries date)))
(entry-found (list-sexp-diary-entries date))) (dolist (date-form diary-date-forms)
(dolist (date-form diary-date-forms) (let*
(let* ((backup (when (eq (car date-form) 'backup)
((backup (when (eq (car date-form) 'backup) (setq date-form (cdr date-form))
(setq date-form (cdr date-form)) t))
t)) (dayname
(dayname (format "%s\\|%s\\.?"
(format "%s\\|%s\\.?" (calendar-day-name date)
(calendar-day-name date) (calendar-day-name date 'abbrev)))
(calendar-day-name date 'abbrev))) (monthname
(monthname (format "\\*\\|%s\\|%s\\.?"
(format "\\*\\|%s\\|%s\\.?" (calendar-month-name month)
(calendar-month-name month) (calendar-month-name month 'abbrev)))
(calendar-month-name month 'abbrev))) (month (concat "\\*\\|0*" (int-to-string month)))
(month (concat "\\*\\|0*" (int-to-string month))) (day (concat "\\*\\|0*" (int-to-string day)))
(day (concat "\\*\\|0*" (int-to-string day))) (year
(year (concat
(concat "\\*\\|0*" (int-to-string year)
"\\*\\|0*" (int-to-string year) (if abbreviated-calendar-year
(if abbreviated-calendar-year (concat "\\|" (format "%02d" (% year 100)))
(concat "\\|" (format "%02d" (% year 100))) "")))
""))) (regexp
(regexp (concat
(concat "\\(\\`\\|\^M\\|\n\\)" mark "?\\("
"\\(\\`\\|\^M\\|\n\\)" mark "?\\(" (mapconcat 'eval date-form "\\)\\(?:")
(mapconcat 'eval date-form "\\)\\(?:") "\\)"))
"\\)")) (case-fold-search t))
(case-fold-search t)) (goto-char (point-min))
(goto-char (point-min)) (while (re-search-forward regexp nil t)
(while (re-search-forward regexp nil t) (if backup (re-search-backward "\\<" nil t))
(if backup (re-search-backward "\\<" nil t)) (if (and (or (char-equal (preceding-char) ?\^M)
(if (and (or (char-equal (preceding-char) ?\^M) (char-equal (preceding-char) ?\n))
(char-equal (preceding-char) ?\n)) (not (looking-at " \\|\^I")))
(not (looking-at " \\|\^I"))) ;; Diary entry that consists only of date.
;; Diary entry that consists only of date. (backward-char 1)
(backward-char 1) ;; Found a nonempty diary entry--make it
;; Found a nonempty diary entry--make it ;; visible and add it to the list.
;; visible and add it to the list. (setq entry-found t)
(setq entry-found t) (let ((entry-start (point))
(let ((entry-start (point)) date-start temp)
date-start temp) (re-search-backward "\^M\\|\n\\|\\`")
(re-search-backward "\^M\\|\n\\|\\`") (setq date-start (point))
(setq date-start (point)) ;; When selective display (rather than
;; When selective display (rather than ;; overlays) was used, diary file used to
;; overlays) was used, diary file used to ;; start in a blank line and end in a
;; start in a blank line and end in a ;; newline. Now that neither of these
;; newline. Now that neither of these ;; need be true, 'move handles the latter
;; need be true, 'move handles the latter ;; and 1/2 kludge the former.
;; and 1/2 kludge the former. (re-search-forward
(re-search-forward "\^M\\|\n" nil 'move
"\^M\\|\n" nil 'move (if (and (bobp) (not (looking-at "\^M\\|\n")))
(if (and (bobp) (not (looking-at "\^M\\|\n"))) 1
1 2))
2)) (while (looking-at " \\|\^I")
(while (looking-at " \\|\^I") (re-search-forward "\^M\\|\n" nil 'move))
(re-search-forward "\^M\\|\n" nil 'move)) (unless (and (eobp) (not (bolp)))
(unless (and (eobp) (not (bolp))) (backward-char 1))
(backward-char 1)) (unless list-only
(unless list-only (remove-overlays date-start (point)
(remove-overlays date-start (point) 'invisible 'diary))
'invisible 'diary)) (setq entry (buffer-substring entry-start (point))
(setq entry (buffer-substring entry-start (point)) temp (diary-pull-attrs entry file-glob-attrs)
temp (diary-pull-attrs entry file-glob-attrs) entry (nth 0 temp))
entry (nth 0 temp)) (add-to-diary-list
(add-to-diary-list date
date entry
entry (buffer-substring
(buffer-substring (1+ date-start) (1- entry-start))
(1+ date-start) (1- entry-start)) (copy-marker entry-start) (nth 1 temp)))))))
(copy-marker entry-start) (nth 1 temp))))))) (or entry-found
(or entry-found (not diary-list-include-blanks)
(not diary-list-include-blanks) (add-to-diary-list date "" "" "" ""))
(add-to-diary-list date "" "" "" "")) (setq date
(setq date (calendar-gregorian-from-absolute
(calendar-gregorian-from-absolute (1+ (calendar-absolute-from-gregorian date))))
(1+ (calendar-absolute-from-gregorian date)))) (setq entry-found nil)))))
(setq entry-found nil)))))
(goto-char (point-min)) (goto-char (point-min))
(run-hooks 'nongregorian-diary-listing-hook (run-hooks 'nongregorian-diary-listing-hook
'list-diary-entries-hook) 'list-diary-entries-hook)
(unless list-only (unless list-only
(if diary-display-hook (if diary-display-hook
(run-hooks 'diary-display-hook) (run-hooks 'diary-display-hook)
(simple-diary-display))) (simple-diary-display)))
(run-hooks 'diary-hook) (run-hooks 'diary-hook)
diary-entries-list)))))) diary-entries-list))))))
...@@ -1190,9 +1189,9 @@ A value of 0 in any position is a wildcard." ...@@ -1190,9 +1189,9 @@ A value of 0 in any position is a wildcard."
(let ((m displayed-month) (let ((m displayed-month)
(y displayed-year)) (y displayed-year))
(increment-calendar-month m y -1) (increment-calendar-month m y -1)
(calendar-for-loop i from 0 to 2 do (dotimes (idummy 3)
(mark-calendar-month m y month day year color) (mark-calendar-month m y month day year color)
(increment-calendar-month m y 1))))) (increment-calendar-month m y 1)))))
(defun mark-calendar-month (month year p-month p-day p-year &optional color) (defun mark-calendar-month (month year p-month p-day p-year &optional color)
"Mark dates in the MONTH/YEAR that conform to pattern P-MONTH/P_DAY/P-YEAR. "Mark dates in the MONTH/YEAR that conform to pattern P-MONTH/P_DAY/P-YEAR.
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment