Function: icalendar-type-of

icalendar-type-of is a byte-compiled function defined in icalendar-ast.el.gz.

Signature

(icalendar-type-of VALUE &optional TYPES)

Documentation

Find the iCalendar type symbol for the type to which VALUE belongs.

TYPES, if specified, should be a list of type symbols to check. TYPES defaults to all type symbols listed in icalendar-value-types.

Source Code

;; Defined in /usr/src/emacs/lisp/calendar/icalendar-ast.el.gz
;; A high-level API for constructing iCalendar syntax nodes in Lisp code:
(defun ical:type-of (value &optional types)
  "Find the iCalendar type symbol for the type to which VALUE belongs.

TYPES, if specified, should be a list of type symbols to check.
TYPES defaults to all type symbols listed in `icalendar-value-types'."
  (require 'icalendar-parser) ; for ical:value-types, ical:list-of-p
  (declare-function ical:list-of-p "icalendar-parser")
  (catch 'found
    (when (ical:ast-node-p value)
      (throw 'found (ical:ast-node-type value)))
    ;; FIXME:  the warning here is spurious, given that icalendar-parser
    ;; is require'd above:
    (with-suppressed-warnings ((free-vars ical:value-types))
      (dolist (type (or types (mapcar #'cdr ical:value-types)))
        (if (ical:expects-list-of-values-p type)
            (when (ical:list-of-p value type)
              (throw 'found type))
          (when (cl-typep value type)
            (throw 'found type)))))))