# HG changeset patch # User Glenn Morris # Date 1130225614 0 # Node ID 2b2388e245c925c932e068d2db5fe1cd61007bf5 # Parent b6b976f53f61d3c70a1e8437fff4250e4494d0f8 (diary-list-entries): Prevent infloop when diary does not end in a newline. Do not assume a blank line at the start of the diary file. diff -r b6b976f53f61 -r 2b2388e245c9 lisp/calendar/diary-lib.el --- a/lisp/calendar/diary-lib.el Tue Oct 25 07:32:56 2005 +0000 +++ b/lisp/calendar/diary-lib.el Tue Oct 25 07:33:34 2005 +0000 @@ -439,10 +439,20 @@ date-start temp) (re-search-backward "\^M\\|\n\\|\\`") (setq date-start (point)) - (re-search-forward "\^M\\|\n" nil t 2) + ;; When selective display (rather than + ;; overlays) was used, diary file used to + ;; start in a blank line and end in a + ;; newline. Now that neither of these + ;; need be true, 'move handles the latter + ;; and 1/2 kludge the former. + (re-search-forward + "\^M\\|\n" nil 'move + (if (and (bobp) (not (looking-at "\^M\\|\n"))) + 1 + 2)) (while (looking-at " \\|\^I") - (re-search-forward "\^M\\|\n" nil t)) - (backward-char 1) + (re-search-forward "\^M\\|\n" nil 'move)) + (unless (eobp) (backward-char 1)) (unless list-only (remove-overlays date-start (point) 'invisible 'diary))