diff options
author | Glenn Morris <rgm@gnu.org> | 2005-10-25 07:33:34 +0000 |
---|---|---|
committer | Glenn Morris <rgm@gnu.org> | 2005-10-25 07:33:34 +0000 |
commit | f77b652537e427472e24a0ba92c547373958e46f (patch) | |
tree | a97fd7dbb2269a4236a3a99c9e3c3b1cbcc3913d /lisp/calendar | |
parent | 3e99f6ee19eb757a0cbdd5eddd30b3334fad682f (diff) | |
download | emacs-f77b652537e427472e24a0ba92c547373958e46f.tar.gz |
(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.
Diffstat (limited to 'lisp/calendar')
-rw-r--r-- | lisp/calendar/diary-lib.el | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/lisp/calendar/diary-lib.el b/lisp/calendar/diary-lib.el index ae42fa98661..896f0755ad8 100644 --- a/lisp/calendar/diary-lib.el +++ b/lisp/calendar/diary-lib.el @@ -439,10 +439,20 @@ If LIST-ONLY is non-nil don't modify or display the buffer, only return a list." 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)) |