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:
parent
fbd1e72836
commit
edf2c908ea
39
tp.el
39
tp.el
@ -3681,23 +3681,28 @@ 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
|
||||||
;; Process each slot value
|
(if slot-supported
|
||||||
(dolist (slot-item args)
|
;; Process each slot value
|
||||||
(cond
|
(progn
|
||||||
;; String: use directly
|
(dolist (slot-item args)
|
||||||
((stringp slot-item)
|
(cond
|
||||||
(push slot-item slot-parts))
|
;; String: use directly
|
||||||
;; List starting with a defined widget name: recursively parse
|
((stringp slot-item)
|
||||||
((and (listp slot-item)
|
(push slot-item slot-parts))
|
||||||
(symbolp (car slot-item))
|
;; List starting with a defined widget name: recursively parse
|
||||||
(assoc (car slot-item) tp-widget-alist))
|
((and (listp slot-item)
|
||||||
(push (tp-widget-parse slot-item) slot-parts))
|
(symbolp (car slot-item))
|
||||||
;; Other values: convert to string
|
(assoc (car slot-item) tp-widget-alist))
|
||||||
(t
|
(push (tp-widget-parse slot-item) slot-parts))
|
||||||
(push (format "%s" slot-item) slot-parts))))
|
;; Other values: convert to string
|
||||||
;; Combine all slot parts into one string
|
(t
|
||||||
(setq slot-value (apply #'concat (nreverse slot-parts))))
|
(push (format "%s" slot-item) slot-parts))))
|
||||||
|
;; Combine all slot parts into one string
|
||||||
|
(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))
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user