Skip to content

Add vui-get-instance to access root instance from buffer #36

@d12frosted

Description

@d12frosted

Context

Related to #35 - when you have vui-rerender and vui-update, you need access to the instance.

Currently vui--root-instance is buffer-local and private. Apps end up maintaining their own instance storage (e.g., vulpea-ui uses a frame→instance hash table).

Proposal

(vui-get-instance &optional buffer)

Return the root vui instance for BUFFER (defaults to current buffer). Returns nil if buffer has no mounted vui instance.

Use case

;; Instead of maintaining separate storage:
(when-let ((inst (vui-get-instance sidebar-buf)))
  (vui-update inst (list :note note)))

This is a small convenience - apps can still manage their own storage if they need more complex mappings (like frame→instance). But for simple cases where buffer→instance is enough, this avoids boilerplate.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions