Function: icalendar-make-param

icalendar-make-param is a macro defined in icalendar-ast.el.gz.

Signature

(icalendar-make-param TYPE VALUE)

Documentation

Construct an iCalendar parameter node of TYPE with value VALUE.

TYPE should be an iCalendar type symbol satisfying icalendar-param-type-symbol-p; it should not be quoted.

VALUE should evaluate to a value appropriate for TYPE. In particular, if TYPE expects a list of values (see icalendar-expects-list-p), VALUE should be such a list. If necessary, the value(s) in VALUE will be wrapped in syntax nodes indicating their type.

For example,

  (icalendar-make-param icalendar-deltoparam
    (list "mailto:minionA@example.com" "mailto:minionB@example.com"))

will return an icalendar-deltoparam node whose value is a list of icalendar-cal-address nodes containing the two addresses.

The resulting syntax node is checked for validity by icalendar-ast-node-valid-p before it is returned.

Source Code

;; Defined in /usr/src/emacs/lisp/calendar/icalendar-ast.el.gz
(defmacro ical:make-param (type value)
  "Construct an iCalendar parameter node of TYPE with value VALUE.

TYPE should be an iCalendar type symbol satisfying
`icalendar-param-type-symbol-p'; it should not be quoted.

VALUE should evaluate to a value appropriate for TYPE.  In particular, if
TYPE expects a list of values (see `icalendar-expects-list-p'), VALUE
should be such a list.  If necessary, the value(s) in VALUE will be
wrapped in syntax nodes indicating their type.

For example,

  (icalendar-make-param icalendar-deltoparam
    (list \"mailto:minionA@example.com\" \"mailto:minionB@example.com\"))

will return an `icalendar-deltoparam' node whose value is a list of
`icalendar-cal-address' nodes containing the two addresses.

The resulting syntax node is checked for validity by
`icalendar-ast-node-valid-p' before it is returned."
  (declare (debug (symbolp form)))
  ;; TODO: support `ical:otherparam'
  (unless (ical:param-type-symbol-p type)
    (error "Not an iCalendar param type: %s" type))
  (let ((value-type (or (get type 'ical:value-type) 'plain-text)))
    (if (ical:expects-list-of-values-p type)
        `(ical:-make-param--list ',type ',value-type ,value)
      `(ical:-make-param--nonlist ',type ',value-type ,value))))