(vui-defcomponent json-schema-form (schema on-submit)
:state ((values (schema-defaults schema))
(errors nil))
:render
(vui-vstack
(render-schema-fields schema values
:on-change (lambda (path val)
(vui-set-state :values (set-at-path values path val))))
(vui-button "Submit"
:on-click (lambda ()
(let ((errs (validate-schema schema values)))
(if errs
(vui-set-state :errors errs)
(funcall on-submit values)))))))
State tracking, cleanup on close, multiple forms per buffer - all handled by the framework. Your validation logic and schema mapping would be the same, just without the infrastructure code. +---------+--------+
| Summary | |
+---------+--------+
| RMS | 4.1620 |
| AVG | 3.9558 |
+---------+--------+
:unicode ┌─────────┬────────┐
│ Summary │ │
├─────────┼────────┤
│ RMS │ 4.1620 │
│ AVG │ 3.9558 │
└─────────┴────────┘
I think there is room for improvement (like use thicker lines for headers in unicode) and I also need to provide a way to override these.
So the core idea is: ephemeral, inline forms that appear at point, collect structured input, execute, and disappear. Not persistent multi-form buffers, but disposable parameter prompts that don't break document flow or switch context to a modal.
The <query the ps of a given server> example is perfect - you want:
This is actually more tractable than what the gist's inline extension was doing. That was about persistent forms with state tracking, cleanup on manual deletion, etc. Your use case is simpler: mount form at point → collect input → unmount → done.
vui.el doesn't support this today, but it's not a huge leap. The pieces are there:
I'd need to think through how it interacts with the host buffer's text properties and undo - that's where the gist's widget-before-change advice complexity came from. But for disposable forms that clean up after themselves, it should be simpler.
If you want to experiment with this, I'd be curious to collaborate. It's a use case I hadn't fully considered, but "structured, validated input for in-document interaction" is a good framing.