Function: icalendar-escape-text-in-region

icalendar-escape-text-in-region is a byte-compiled function defined in icalendar-parser.el.gz.

Signature

(icalendar-escape-text-in-region BEGIN END)

Documentation

Escape the text between BEGIN and END in the current buffer.

Escaping replaces newlines with literal '\n', and escapes commas, semicolons and backslashes with a backslash.

Source Code

;; Defined in /usr/src/emacs/lisp/calendar/icalendar-parser.el.gz
(defun ical:escape-text-in-region (begin end)
  "Escape the text between BEGIN and END in the current buffer.
Escaping replaces newlines with literal '\\n', and escapes commas,
semicolons and backslashes with a backslash."
 (with-restriction begin end
  (save-excursion
    ;; replace backslashes first, so the ones introduced when
    ;; escaping other characters don't end up double-escaped:
    (replace-string-in-region "\\" (concat "\\" "\\") (point-min) (point-max))
    (replace-string-in-region "\n" "\\n" (point-min) (point-max))
    (replace-string-in-region "," "\\," (point-min) (point-max))
    (replace-string-in-region ";" "\\;" (point-min) (point-max)))))