Function: icalendar-trigger-validator

icalendar-trigger-validator is a byte-compiled function defined in icalendar-parser.el.gz.

Signature

(icalendar-trigger-validator NODE)

Documentation

Additional validator for an icalendar-trigger NODE.

Checks that NODE has valid parameters depending on the type of its value.

This function is called by icalendar-ast-node-valid-p for TRIGGER nodes; it is not normally necessary to call it directly.

Source Code

;; Defined in /usr/src/emacs/lisp/calendar/icalendar-parser.el.gz
(defun ical:trigger-validator (node)
  "Additional validator for an `icalendar-trigger' NODE.
Checks that NODE has valid parameters depending on the type of its value.

This function is called by `icalendar-ast-node-valid-p' for
TRIGGER nodes; it is not normally necessary to call it directly."
  (let* ((params (ical:ast-node-children node))
         (value-node (ical:ast-node-value node))
         (value-type (and value-node (ical:ast-node-type value-node))))
    (when (eq value-type 'ical:date-time)
      (let ((expl-type (ical:value-type-from-params params))
            (dt-value (ical:ast-node-value value-node)))
        (unless (eq expl-type 'ical:date-time)
          (ical:signal-validation-error
           (concat "Explicit `icalendar-valuetypeparam' required in "
                   "`icalendar-trigger' with non-duration value")
           :node node))
        (when (ical:ast-node-first-child-of 'ical:trigrelparam node)
          (ical:signal-validation-error
           (concat "`icalendar-trigrelparam' not allowed in "
                   "`icalendar-trigger' with non-duration value")
           :node node))
        (unless (ical:date-time-is-utc-p dt-value)
          (ical:signal-validation-error
           (concat "`icalendar-date-time' value of `icalendar-trigger' "
                   "must be in UTC time")
           :node node))))
    ;; success:
    node))