diff options
Diffstat (limited to 'lisp/calendar')
-rw-r--r-- | lisp/calendar/cal-html.el | 9 | ||||
-rw-r--r-- | lisp/calendar/calendar.el | 8 | ||||
-rw-r--r-- | lisp/calendar/diary-lib.el | 17 | ||||
-rw-r--r-- | lisp/calendar/holidays.el | 5 | ||||
-rw-r--r-- | lisp/calendar/icalendar.el | 17 |
5 files changed, 36 insertions, 20 deletions
diff --git a/lisp/calendar/cal-html.el b/lisp/calendar/cal-html.el index 4bddc384895..8c46e3ade74 100644 --- a/lisp/calendar/cal-html.el +++ b/lisp/calendar/cal-html.el @@ -32,6 +32,7 @@ ;;; Code: (require 'calendar) +(require 'diary-lib) (defgroup calendar-html nil @@ -358,12 +359,12 @@ of holidays, rather than diary entries." ;; Monthly calendar ;;------------------------------------------------------------ -(autoload 'diary-list-entries "diary-lib") - (defun cal-html-list-diary-entries (d1 d2) "Generate a list of all diary-entries from absolute date D1 to D2." - (diary-list-entries (calendar-gregorian-from-absolute d1) - (1+ (- d2 d1)) t)) + (if (with-demoted-errors "Not adding diary entries: %S" + (diary-check-diary-file)) + (diary-list-entries (calendar-gregorian-from-absolute d1) + (1+ (- d2 d1)) t))) (defun cal-html-insert-agenda-days (month year diary-list holiday-list) "Insert HTML commands for a range of days in monthly calendars. diff --git a/lisp/calendar/calendar.el b/lisp/calendar/calendar.el index 6c1b4c258e9..4c659bfa29c 100644 --- a/lisp/calendar/calendar.el +++ b/lisp/calendar/calendar.el @@ -881,11 +881,11 @@ is a list of expressions that can involve the keywords `month', `day', and `year' (all numbers in string form), and `monthname' and `dayname' \(both alphabetic strings). For example, a typical American form would be - '(month \"/\" day \"/\" (substring year -2)) + (month \"/\" day \"/\" (substring year -2)) whereas - '((format \"%9s, %9s %2s, %4s\" dayname monthname day year)) + ((format \"%9s, %9s %2s, %4s\" dayname monthname day year)) would give the usual American style in fixed-length fields. The variables `calendar-iso-date-display-form', `calendar-european-date-display-form', and @@ -1184,8 +1184,8 @@ A negative year is interpreted as BC; -1 being 1 BC, and so on." (defsubst calendar-day-number (date) "Return the day number within the year of the date DATE. -For example, (calendar-day-number '(1 1 1987)) returns the value 1, -while (calendar-day-number '(12 31 1980)) returns 366." +For example, (calendar-day-number \\='(1 1 1987)) returns the value 1, +while (calendar-day-number \\='(12 31 1980)) returns 366." (let* ((month (calendar-extract-month date)) (day (calendar-extract-day date)) (year (calendar-extract-year date)) diff --git a/lisp/calendar/diary-lib.el b/lisp/calendar/diary-lib.el index 7382abf67fc..0720d8266a0 100644 --- a/lisp/calendar/diary-lib.el +++ b/lisp/calendar/diary-lib.el @@ -909,13 +909,15 @@ This is recursive; that is, included files may include other files." (append diary-entries-list (diary-list-entries original-date number t))))) (display-warning - :error + 'diary (format-message "Can't read included diary file %s\n" - diary-file))) + diary-file) + :error)) (display-warning - :error + 'diary (format-message "Can't find included diary file %s\n" - diary-file))))) + diary-file) + :error)))) (goto-char (point-min))) (defun diary-include-other-diary-files () @@ -1190,7 +1192,7 @@ ensure that all relevant variables are set. \(setq diary-mail-days 3 diary-file \"/path/to/diary.file\" - calendar-date-style 'european + calendar-date-style \\='european diary-mail-addr \"user@host.name\") \(diary-mail-entries) @@ -1410,11 +1412,12 @@ marks. This is intended to deal with deleted diary entries." (eval (car (read-from-string sexp))) (error (display-warning - :error + 'diary (format "Bad diary sexp at line %d in %s:\n%s\n\ Error: %s\n" (count-lines (point-min) (point)) - diary-file sexp err)) + diary-file sexp err) + :error) nil)))))) (cond ((stringp result) result) ((and (consp result) diff --git a/lisp/calendar/holidays.el b/lisp/calendar/holidays.el index 307ab4deb82..3e7289bb030 100644 --- a/lisp/calendar/holidays.el +++ b/lisp/calendar/holidays.el @@ -346,9 +346,10 @@ The holidays are those in the list `calendar-holidays'." (eval p) (error (display-warning - :error + 'holidays (format "Bad holiday list item: %s\nError: %s\n" - p err)) + p err) + :error) nil)))) (setq res (append h res)))) 'calendar-date-compare))) diff --git a/lisp/calendar/icalendar.el b/lisp/calendar/icalendar.el index 0955e72aa04..ca6669d0c40 100644 --- a/lisp/calendar/icalendar.el +++ b/lisp/calendar/icalendar.el @@ -321,18 +321,29 @@ other sexp entries are enumerated in any case." "Return a new buffer containing the unfolded contents of a buffer. Folding is the iCalendar way of wrapping long lines. In the created buffer all occurrences of CR LF BLANK are replaced by the -empty string. Argument FOLDED-ICAL-BUFFER is the unfolded input +empty string. Argument FOLDED-ICAL-BUFFER is the folded input buffer." (let ((unfolded-buffer (get-buffer-create " *icalendar-work*"))) (save-current-buffer (set-buffer unfolded-buffer) (erase-buffer) (insert-buffer-substring folded-ical-buffer) + (icalendar--clean-up-line-endings) (goto-char (point-min)) (while (re-search-forward "\r?\n[ \t]" nil t) (replace-match "" nil nil))) unfolded-buffer)) +(defun icalendar--clean-up-line-endings () + "Replace DOS- and MAC-like line endings with unix line endings. +All occurrences of (CR LF) and (LF CF) are replaced with LF in +the current buffer. This is necessary in buffers which contain a +mix of different line endings." + (save-excursion + (goto-char (point-min)) + (while (re-search-forward "\r\n\\|\n\r" nil t) + (replace-match "\n" nil nil)))) + (defsubst icalendar--rris (regexp rep string &optional fixedcase literal) "Replace regular expression in string. Pass arguments REGEXP REP STRING FIXEDCASE LITERAL to @@ -1296,8 +1307,8 @@ Returns an alist." "Return a VALARM block. Argument ADVANCE-TIME is a number giving the time when the alarm fires (minutes before the respective event). Argument ALARM-SPEC -is a list which must be one of '(audio), '(display) or -'(email (ADDRESS1 ...)), see `icalendar-export-alarms'. Argument +is a list which must be one of (audio), (display) or +(email (ADDRESS1 ...)), see `icalendar-export-alarms'. Argument SUMMARY is a string which contains a short description for the alarm." (let* ((action (car alarm-spec)) |