Fix iCalendar macro (debug ...) forms and indentation

As discussed in Bug#74994.

* lisp/calendar/icalendar-ast.el (icalendar-make-param)
(icalendar-make-property, icalendar-make-component)
(icalendar-make-node-from-templates)
* lisp/calendar/icalendar-macs.el (icalendar-with-node-children)
(icalendar-with-node-value, icalendar-with-param)
(icalendar-with-child-of, icalendar-with-property-of): Remove extraneous
arguments in (debug ...) forms.
* lisp/calendar/icalendar-recur.el
* lisp/calendar/diary-icalendar.el: Fix indentation of calls to them.

Plus one other minor fix:

* lisp/calendar/diary-icalendar.el
(diary-icalendar-current-tz-to-vtimezone): Ignore unused error
variable (fixes a byte compiler warning).
This commit is contained in:
Richard Lawrence 2026-01-07 18:19:13 +01:00 committed by Stefan Monnier
parent 74750e269b
commit 4db3be2001
4 changed files with 38 additions and 38 deletions

View file

@ -2111,7 +2111,7 @@ node. Return this node, or nil."
(when (and di:class-regexp
(re-search-forward di:class-regexp nil t))
(ical:make-property ical:class
(upcase (string-trim (match-string 1))))))
(upcase (string-trim (match-string 1))))))
(defun di:parse-status ()
"Parse `icalendar-status' node from entry.
@ -2123,7 +2123,7 @@ as an `icalendar-status' node. Return this node, or nil."
(when (and di:status-regexp
(re-search-forward di:status-regexp nil t))
(ical:make-property ical:status
(upcase (string-trim (match-string 1))))))
(upcase (string-trim (match-string 1))))))
(defun di:parse-url ()
"Parse `icalendar-url' node from entry.
@ -2635,7 +2635,7 @@ Returns a pair of nodes (START RRULE)."
"`diary-float' with large N=%d may not be supported on other systems" n)))
(list (ical:make-property ical:dtstart dtstart
(ical:valuetypeparam 'ical:date))
(ical:valuetypeparam 'ical:date))
(ical:make-property ical:rrule rrule))))
(defun di:offset-sexp-to-nodes (sexp)
@ -2824,7 +2824,7 @@ formatting alarms as mail messages. Returns the modified COMPONENT."
(setq all-attendees (append entry-attendees all-attendees)))
((stringp address)
(push (ical:make-property ical:attendee
(concat "mailto:" address))
(concat "mailto:" address))
all-attendees))))
(push (ical:make-valarm
(ical:action "EMAIL")
@ -2968,7 +2968,7 @@ nil, if MONTHS, DAYS and YEARS are all integers)."
(rrule-node (when freq (ical:make-property ical:rrule recur-value)))
(rdate-node (when rdates
(ical:make-property ical:rdate rdates
(ical:valuetypeparam rdate-type))))
(ical:valuetypeparam rdate-type))))
(dtstart-node (ical:make-property ical:dtstart dtstart)))
(list dtstart-node (or rrule-node rdate-node))))))
@ -3050,16 +3050,16 @@ property and must be present even if the recurrence set is empty.)"
(append
(list
(ical:make-property ical:dtstart dtstart
(ical:valuetypeparam 'ical:date))
(ical:valuetypeparam 'ical:date))
;; TODO: should we maybe use an X-name property for this?
(ical:make-property ical:comment (format "%s" sexp)))
(if rdates
(list
(ical:make-property ical:rdate rdates
(ical:valuetypeparam 'ical:date)))
(ical:valuetypeparam 'ical:date)))
(list
(ical:make-property ical:exdate exdates
(ical:valuetypeparam 'ical:date)))))))
(ical:valuetypeparam 'ical:date)))))))
(defun di:sexp-to-nodes (sexp &optional vtimezone)
"Convert a diary S-expression SEXP to a list of iCalendar property nodes.
@ -3110,7 +3110,7 @@ times according to `diary-icalendar-time-zone-export-strategy'."
See `icalendar-recur-current-tz-to-vtimezone' for arguments' meanings.
This function wraps that one, but signals `icalendar-diary-export-error'
instead if TZ cannot be converted."
(condition-case err
(condition-case _
(icr:current-tz-to-vtimezone tz tzid start-year)
((ical:tz-insufficient-data ical:tz-unsupported)
(di:signal-export-error
@ -3270,7 +3270,7 @@ recursive calls to this function made by
:buffer (current-buffer)
:position (point)))
(push (ical:make-property ical:duration
(ical:duration-between dtstart dtend))
(ical:duration-between dtstart dtend))
all-props))
;; Otherwise we make a normal DTEND:
(push (ical:make-property ical:dtend dtend)
@ -3309,7 +3309,7 @@ recursive calls to this function made by
vtimezone)))
values)))
(push (ical:make-property ical:rdate rdates
(ical:tzidparam tzid))
(ical:tzidparam tzid))
all-props)))
;; preserve any other node read from date, e.g. RRULE, as is:
@ -3341,7 +3341,7 @@ recursive calls to this function made by
(when url (push url all-props)))
(push (or (di:parse-uid)
(ical:make-property ical:uid
(ical:make-uid all-props)))
(ical:make-uid all-props)))
all-props)
;; Allow users to add to the properties parsed:

View file

@ -358,7 +358,7 @@ VALUE does not satisfy (any type in) TYPE."
(signal 'wrong-type-argument (list `(list-of ,type) value)))
(unless (cl-typep value type)
(signal 'wrong-type-argument (list type value)))
(ical:make-ast-node type (list :value value))))
(ical:make-ast-node type (list :value value))))
((listp type)
;; N.B. nil is allowed; in that case, `ical:type-of' will check all
;; types in `ical:value-types':
@ -416,7 +416,7 @@ will return an `icalendar-deltoparam' node whose value is a list of
The resulting syntax node is checked for validity by
`icalendar-ast-node-valid-p' before it is returned."
(declare (debug (symbolp form form)))
(declare (debug (symbolp form)))
;; TODO: support `ical:otherparam'
(unless (ical:param-type-symbol-p type)
(error "Not an iCalendar param type: %s" type))
@ -490,7 +490,7 @@ The resulting syntax node is checked for validity by
`icalendar-ast-node-valid-p' before it is returned."
;; TODO: support `ical:other-property', maybe like
;; (ical:other-property "X-NAME" value ...)
(declare (debug (symbolp form form &rest form))
(declare (debug (symbolp form &rest form))
(indent 2))
(unless (ical:property-type-symbol-p type)
(error "Not an iCalendar property type: %s" type))
@ -554,7 +554,7 @@ properties.
The resulting syntax node is checked for validity by
`icalendar-ast-node-valid-p' before it is returned."
(declare (debug (symbolp form &rest form))
(declare (debug (symbolp &rest form))
(indent 1))
;; TODO: support `ical:other-component', maybe like
;; (ical:other-component (:x-name "X-NAME") templates ...)
@ -662,7 +662,7 @@ For example, an iCalendar VEVENT could be written like this:
Before the constructed node is returned, it is validated by
`icalendar-ast-node-valid-p'."
(declare (debug (symbolp form &rest form))
(declare (debug (symbolp &rest form))
(indent 1))
(cond
((not (ical:type-symbol-p type))

View file

@ -830,7 +830,7 @@ Each binding in BINDINGS should be a list of one of the following forms:
nodes), or the :value-nodes themselves (if they are not).
It is a compile-time error to use the singular keywords with a TYPE that
takes multiple values, or the plural keywords with a TYPE that does not."
(declare (debug (symbolp form form &rest form))
(declare (debug (form form &rest form))
(indent 2))
;; Static checks on the bindings prevent various annoying bugs:
(dolist (b bindings)
@ -1004,7 +1004,7 @@ is equivalent to
BINDINGS are passed on to `icalendar-with-node-children' and will be
available in BODY; see its docstring for their form."
(declare (debug (symbolp form &optional form &rest form))
(declare (debug (form &optional form &rest form))
(indent 2))
(let ((vn (gensym "icalendar-node"))
(val (gensym "icalendar-value"))
@ -1069,7 +1069,7 @@ node's value.
If PARAMETER's value is not a syntax node, then `value' is bound
directly to PARAMETER's value, and `value-type' and `value-node' are
bound to nil."
(declare (debug (symbolp form &rest form))
(declare (debug (form &rest form))
(indent 1))
`(ical:with-node-value ,parameter nil ,@body))
@ -1089,7 +1089,7 @@ is equivalent to
(icalendar-with-child-of some-node some-type nil value)
See `icalendar-with-node-children' for the form of BINDINGS."
(declare (debug (symbolp form form &optional form &rest form))
(declare (debug (form form &optional form &rest form))
(indent 3))
(let ((child (gensym "icalendar-node")))
`(let ((,child (ical:ast-node-first-child-of ,type ,node)))
@ -1123,7 +1123,7 @@ symbol `value'; thus
(icalendar-with-param-of some-property some-type)
is equivalent to
(icalendar-with-param-of some-property some-type nil value)"
(declare (debug (symbolp form form &rest form))
(declare (debug (form form &rest form))
(indent 2))
`(ical:with-child-of ,node ,type nil ,@body))

View file

@ -2123,22 +2123,22 @@ to start the observances in the time zone. It defaults to 1970."
:minute (mod dst-end-minutes 60)
:second 0)))
(ical:make-vtimezone
(ical:tzid (or tzid (concat icr:-emacs-local-tzid std-name)))
(ical:make-standard
(ical:tzname std-name)
(ical:dtstart std-start)
(ical:rrule dst->std-rule)
(ical:tzoffsetfrom dst-offset)
(ical:tzoffsetto std-offset)
(ical:comment icr:-tz-warning))
(ical:make-daylight
(ical:tzname dst-name)
(ical:dtstart dst-start)
(ical:rrule std->dst-rule)
(ical:tzoffsetfrom std-offset)
(ical:tzoffsetto dst-offset)
(ical:comment icr:-tz-warning)))))))
(ical:make-vtimezone
(ical:tzid (or tzid (concat icr:-emacs-local-tzid std-name)))
(ical:make-standard
(ical:tzname std-name)
(ical:dtstart std-start)
(ical:rrule dst->std-rule)
(ical:tzoffsetfrom dst-offset)
(ical:tzoffsetto std-offset)
(ical:comment icr:-tz-warning))
(ical:make-daylight
(ical:tzname dst-name)
(ical:dtstart dst-start)
(ical:rrule std->dst-rule)
(ical:tzoffsetfrom std-offset)
(ical:tzoffsetto dst-offset)
(ical:comment icr:-tz-warning)))))))
(provide 'icalendar-recur)