Skip to content

feat: per-widget collapse state - #83

Merged
d12frosted merged 1 commit into
masterfrom
feat/vulpea-internal-widgets-collapse-991fdf
Sep 29, 2026
Merged

d12frosted merged 1 commit into
masterfrom
feat/vulpea-internal-widgets-collapse-991fdf

Conversation

@d12frosted

Copy link
Copy Markdown
Owner

Whether a widget starts collapsed came from one global switch, vulpea-ui-default-widget-collapsed. So folding the long built-in widgets also folded your own widgets, and there was no way to fold just one of them.

Now :collapsed on vulpea-ui-register-widget decides it for that widget alone: t starts it collapsed, nil starts it expanded even when the global default folds everything. Without :collapsed a widget follows the global value like before. vulpea-ui-widget-set sets it on built-in widgets and widgets from other packages (like vulpea-journal).

;; fold everything except my own widget
(setq vulpea-ui-default-widget-collapsed t)
(vulpea-ui-register-widget 'my-widget
  :component 'my-widget-component
  :collapsed nil)

;; or fold just the long ones
(vulpea-ui-widget-set 'backlinks :collapsed t)

It lives in the registry rather than as a prop on vulpea-ui-widget because it's a user preference, and a prop would only help widgets you write yourself. The sidebar hands each widget its registry entry through a context that the wrapper reads, so no widget code changes. vulpea-ui--get-widgets-for-note now returns the registry entries instead of bare component symbols.

Closes #80

Whether a widget starts collapsed came only from
vulpea-ui-default-widget-collapsed, one switch for every widget.
Folding the long built-in widgets folded your own widgets too, and
there was no way to fold just one of them.

vulpea-ui-register-widget now takes :collapsed, which decides for that
widget alone: t starts it collapsed, nil starts it expanded whatever
the global value says. Without :collapsed a widget follows the global
value as before. vulpea-ui-widget-set sets it on built-in and
third-party widgets.

The sidebar provides each widget's registry entry through a context
that the vulpea-ui-widget wrapper reads, so widget code does not
change.

Closes #80
@d12frosted
d12frosted merged commit 6e92094 into master Sep 29, 2026
0 of 2 checks passed
@d12frosted
d12frosted deleted the feat/vulpea-internal-widgets-collapse-991fdf branch September 29, 2026 13:34
d12frosted added a commit that referenced this pull request Sep 29, 2026
Emacs 30 runs checkdoc's verb check by default, and it flagged
"starts" in the first sentence of vulpea-ui--widget-collapsed-p's
docstring (added in #83), failing lint in the 30.2 CI job. Emacs 31.1
turned the check off by default, so lint passed on snapshot and on
newer local builds.

The docstring now says "should start", and Eldev turns the check on
for every Emacs version, so lint gives the same result everywhere.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat: expose the collapse property in vulpea-ui-widget

1 participant