Function: diary-icalendar-parse-summary-and-description

diary-icalendar-parse-summary-and-description is a byte-compiled function defined in diary-icalendar.el.gz.

Signature

(diary-icalendar-parse-summary-and-description)

Documentation

Parse summary and description nodes from current restriction.

When diary-icalendar-summary-regexp or diary-icalendar-description-regexp are non-nil, and the entry matches them, the matches will be used to generate the summary and description.

Otherwise, the first line of the entry (after any nonmarking symbol and date and time specification) is used as the summary. The description is the full body of the entry, excluding the nonmarking symbol, date and time, but including the summary.

Returns a list containing an icalendar-summary node and icalendar-description node, or nil.

Source Code

;; Defined in /usr/src/emacs/lisp/calendar/diary-icalendar.el.gz
(defun di:parse-summary-and-description ()
  "Parse summary and description nodes from current restriction.

When `diary-icalendar-summary-regexp' or
`diary-icalendar-description-regexp' are non-nil, and the entry matches
them, the matches will be used to generate the summary and description.

Otherwise, the first line of the entry (after any nonmarking symbol and
date and time specification) is used as the summary.  The description is
the full body of the entry, excluding the nonmarking symbol, date and
time, but including the summary.

Returns a list containing an `icalendar-summary' node and
`icalendar-description' node, or nil."
  (goto-char (point-min))
  (let (summary description)
    (when (and di:summary-regexp
               (re-search-forward di:summary-regexp nil t))
      (setq summary (match-string 1)))
    (goto-char (point-min))
    (when (and di:description-regexp
               (re-search-forward di:description-regexp nil t))
      (setq description (match-string 1)))
    ;; Fall back to using first line and entire entry:
    (goto-char (point-min))
    (while (looking-at-p "[[:space:]]")
      (forward-char))
    (unless summary
      (setq summary (buffer-substring (point) (line-end-position))))
    (unless description
      (setq description (buffer-substring (point) (point-max))))
    ;; Remove any indentation on subsequent lines from description:
    (setq description (replace-regexp-in-string "^[[:space:]]+" "" description))

    (list (ical:make-property ical:summary summary)
          (ical:make-property ical:description description))))