Function: icalendar-contains-unfolded-lines-p

icalendar-contains-unfolded-lines-p is a byte-compiled function defined in icalendar-parser.el.gz.

Signature

(icalendar-contains-unfolded-lines-p &optional BUFFER)

Documentation

Return non-nil if BUFFER contains long content lines that should be folded.

Lines longer than 75 bytes need to folded before saving or transmitting the data in BUFFER (default: current buffer). If BUFFER contains such lines, return the position at the beginning of the first line that requires folding.

Source Code

;; Defined in /usr/src/emacs/lisp/calendar/icalendar-parser.el.gz
(defun ical:contains-unfolded-lines-p (&optional buffer)
  "Return non-nil if BUFFER contains long content lines that should be folded.

Lines longer than 75 bytes need to folded before saving or transmitting
the data in BUFFER (default: current buffer).  If BUFFER contains such
lines, return the position at the beginning of the first line that
requires folding."
  (with-current-buffer (or buffer (current-buffer))
    (save-excursion
      (goto-char (point-min))
      (let ((bol (point))
            (eol (make-marker)))
        (catch 'unfolded-line
          (while (< bol (point-max))
            (let ((inhibit-field-text-motion t))
              (end-of-line))
            (set-marker eol (point))
            ;; the max of 75 excludes the two CR-LF characters
            ;; after position eol:
            (when (< 75 (- (position-bytes (marker-position eol))
                           (position-bytes bol)))
              (throw 'unfolded-line bol))
            (setq bol (goto-char (1+ eol))))
          nil)))))