Function: org-icalendar-fold-string

org-icalendar-fold-string is a byte-compiled function defined in ox-icalendar.el.gz.

Signature

(org-icalendar-fold-string S)

Documentation

Fold string S according to RFC 5545.

Source Code

;; Defined in /usr/src/emacs/lisp/org/ox-icalendar.el.gz
(defun org-icalendar-fold-string (s)
  "Fold string S according to RFC 5545."
  (org-element-normalize-string
   (mapconcat
    (lambda (line)
      ;; Limit each line to a maximum of 75 characters.  If it is
      ;; longer, fold it by using "\r\n " as a continuation marker.
      (let ((len (length line)))
	(if (<= len 75) line
	  (let ((folded-line (substring line 0 75))
		(chunk-start 75)
		chunk-end)
	    ;; Since continuation marker takes up one character on the
	    ;; line, real contents must be split at 74 chars.
	    (while (< (setq chunk-end (+ chunk-start 74)) len)
	      (setq folded-line
		    (concat folded-line "\n "
			    (substring line chunk-start chunk-end))
		    chunk-start chunk-end))
	    (concat folded-line "\n " (substring line chunk-start))))))
    (org-split-string s "\n") "\n")))