Function: icalendar-print-component-node

icalendar-print-component-node is a byte-compiled function defined in icalendar-parser.el.gz.

Signature

(icalendar-print-component-node NODE)

Documentation

Serialize a component syntax node NODE to a string.

Source Code

;; Defined in /usr/src/emacs/lisp/calendar/icalendar-parser.el.gz
(defun ical:print-component-node (node)
  "Serialize a component syntax node NODE to a string."
  (let* ((type (ical:ast-node-type node))
         (name (or (ical:ast-node-meta-get :original-name node)
                   (car (rassq type ical:component-types))))
         (children (ical:ast-node-children node))
         body)

    (unless name
      (ical:signal-print-error
       (format "Unknown component name for type `%s'" type)
       :node node))

    (dolist (child children)
      (condition-case err
          (setq body
                (concat body (ical:print-property-or-component child)))
        (ical:print-error
         (if (ical:ast-node-required-child-p child node)
             (ical:signal-print-error
              (format
               "Unable to print required `%s' %s in `%s' component.  Error was:\n%s"
               (ical:ast-node-type child)
               (if (ical:component-node-p child) "subcomponent" "property")
               (ical:ast-node-type node)
               (plist-get (cdr err) :message))
              :node node)
           (ical:handle-print-error err)))))
    (concat
     (format "BEGIN:%s\n" name)
     body
     (format "END:%s\n" name))))