-;;; icalendar.el --- iCalendar implementation -*-coding: utf-8 -*-
+;;; icalendar.el --- iCalendar implementation
-;; Copyright (C) 2002-2015 Free Software Foundation, Inc.
+;; Copyright (C) 2002-2016 Free Software Foundation, Inc.
;; Author: Ulf Jasper <ulf.jasper@web.de>
;; Created: August 2002
"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
result))
(defun icalendar--split-value (value-string)
- "Split VALUE-STRING at ‘;=’."
+ "Split VALUE-STRING at `;='."
(let ((result '())
param-name param-value)
(when value-string
(setq found-error t)
(save-current-buffer
(set-buffer (get-buffer-create "*icalendar-errors*"))
- (insert (format-message "Error in line %d -- %s: ‘%s’\n"
+ (insert (format-message "Error in line %d -- %s: `%s'\n"
(count-lines (point-min) (point))
error-val
entry-main))))))
"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))
(when day
(progn
(icalendar--dmsg "diary-float %s" entry-main)
- (error "Don't know if or how to implement day in ‘diary-float’")))
+ (error "Don't know if or how to implement day in `diary-float'")))
(cons (concat
;;Start today (yes this is an arbitrary choice):
entry-main)
(progn
(icalendar--dmsg "diary-date %s" entry-main)
- (error "‘diary-date’ is not supported yet"))
+ (error "`diary-date' is not supported yet"))
;; no match
nil))
(rrule (icalendar--get-event-property e 'RRULE))
(rdate (icalendar--get-event-property e 'RDATE))
(duration (icalendar--get-event-property e 'DURATION)))
- (icalendar--dmsg "%s: ‘%s’" start-d summary)
+ (icalendar--dmsg "%s: `%s'" start-d summary)
;; check whether start-time is missing
(if (and dtstart
(string=
interval))))
)
(t
- (message "Cannot handle COUNT attribute for ‘%s’ events."
+ (message "Cannot handle COUNT attribute for `%s' events."
frequency)))
(setq until-conv (icalendar--datetime-to-diary-date until))
(setq until-1-conv (icalendar--datetime-to-diary-date until-1))
entry. In this case the user will be asked whether he wants to insert
the entry."
(when (or (not summary)
- (y-or-n-p (format-message "Add appointment for ‘%s’ to diary? "
+ (y-or-n-p (format-message "Add appointment for `%s' to diary? "
summary)))
(when summary
(setq non-marking