Function: icalendar-default-value-printer

icalendar-default-value-printer is a byte-compiled function defined in icalendar-parser.el.gz.

Signature

(icalendar-default-value-printer VAL)

Documentation

Default printer for a *single* property or parameter value.

If VAL is a string, just return it unchanged.

Otherwise, VAL should be a syntax node representing a value. In that case, return the original string value if another was substituted at parse time, or look up the printer function for the node's type and call it on the value inside the node.

For properties and parameters that only allow a single value, this function should be a sufficient value printer. It is not sufficient for those that allow lists of values, or which have other special requirements like quoting or escaping.

Source Code

;; Defined in /usr/src/emacs/lisp/calendar/icalendar-parser.el.gz
(defun ical:default-value-printer (val)
  "Default printer for a *single* property or parameter value.

If VAL is a string, just return it unchanged.

Otherwise, VAL should be a syntax node representing a value.  In
that case, return the original string value if another was
substituted at parse time, or look up the printer function for
the node's type and call it on the value inside the node.

For properties and parameters that only allow a single value,
this function should be a sufficient value printer.  It is not
sufficient for those that allow lists of values, or which have
other special requirements like quoting or escaping."
  (cond ((stringp val) val)
        ((and (ical:ast-node-p val)
              (get (ical:ast-node-type val) 'ical:value-printer))
         (or (ical:ast-node-meta-get :original-value val)
             (let* ((stored-value (ical:ast-node-value val))
                    (type (ical:ast-node-type val))
                    (printer (get type 'ical:value-printer)))
               (funcall printer stored-value))))
        ;; TODO: other cases to make things easy?
        ;; e.g. symbols print as their names?
        (t (ical:signal-print-error
            (format "Don't know how to print value: %s" val)))))