Add warning for unused slot arguments when slot is not supported

Co-authored-by: Kinneyzhang <38454496+Kinneyzhang@users.noreply.github.com>
This commit is contained in:
copilot-swe-agent[bot] 2025-12-29 01:16:12 +00:00
parent fbd1e72836
commit edf2c908ea

7
tp.el
View File

@ -3681,8 +3681,10 @@ Returns the rendered string with text properties applied."
(push (cons key val) collected-props) (push (cons key val) collected-props)
(setq args (cddr args)))) (setq args (cddr args))))
;; The remaining arguments are slot values (if slot is supported) ;; The remaining arguments are slot values (if slot is supported)
(when (and slot-supported args) (when args
(if slot-supported
;; Process each slot value ;; Process each slot value
(progn
(dolist (slot-item args) (dolist (slot-item args)
(cond (cond
;; String: use directly ;; String: use directly
@ -3698,6 +3700,9 @@ Returns the rendered string with text properties applied."
(push (format "%s" slot-item) slot-parts)))) (push (format "%s" slot-item) slot-parts))))
;; Combine all slot parts into one string ;; Combine all slot parts into one string
(setq slot-value (apply #'concat (nreverse slot-parts)))) (setq slot-value (apply #'concat (nreverse slot-parts))))
;; Slot not supported - warn about ignored arguments
(warn "tp-widget-parse: Widget `%s' does not support slot content. \
Ignoring arguments: %S" widget-name args)))
;; Build the props plist with defaults ;; Build the props plist with defaults
(dolist (prop-def prop-defs) (dolist (prop-def prop-defs)
(let* ((prop-name (tp--widget-prop-name prop-def)) (let* ((prop-name (tp--widget-prop-name prop-def))