Skip to content

Move project settings into cascading .aegiconf files - #775

Open
rcombs wants to merge 10 commits into
TypesettingTools:masterfrom
rcombs:codex/aegiconf
Open

rcombs wants to merge 10 commits into
TypesettingTools:masterfrom
rcombs:codex/aegiconf

Conversation

@rcombs

@rcombs rcombs commented Nov 7, 2026 •

Copy link
Copy Markdown
Contributor

Saving ASS subtitles now writes current project settings to .aegiconf-[full filename] by default, keeping local project state out of subtitle diffs. When Save Project Settings in Subtitle File is disabled, existing in-file settings are preserved as loaded rather than removed or updated; files without them remain without them. Legacy settings in [Script Info] may migrate into [Aegisub Project Garbage] while retaining their loaded values.

Load shared .aegiconf files from ancestor directories, then the per-subtitle config, with closer files overriding earlier ones. Discovery stops at Git and filesystem boundaries. Loading any matching config, including an empty file, discards all inline project settings from the active configuration while retaining their load-time values for saving. Legacy settings remain the fallback when no config is loaded.

Support ordered video, audio, keyframe, and timecode patterns relative to the subtitle directory, plus Audio File: ?video. Pattern-derived paths are omitted from saved overrides, and comments, unknown directives, and active patterns are preserved. The Save Project Settings in Subtitle File preference updates inline settings when enabled; config loading can be disabled separately. Recovery autosaves retain embedded project settings and resolved paths.

Includes separate filesystem utility commits, documentation, and regression coverage for config precedence, legacy-setting replacement, relative paths, patterns, discovery boundaries, repeated saves, and preservation of original inline settings.

🤖 Codex

Preserve the directive when project paths are refreshed and saved, and clear it when audio is explicitly opened or closed.
Use directory attributes and the reparse tag to recognize mounted folders on Windows, and compare directory and parent device IDs on POSIX. Treat filesystem roots as mount points.
Read configs with TextFileReader and search media patterns relative to the subtitle directory. Stop discovery at Git or filesystem boundaries and allow config loading to be disabled.
@rcombs
rcombs marked this pull request as ready for review November 7, 2026 22:48
@JohhanSam

Copy link
Copy Markdown

This is a really cool feature, went to port it when I saw it on my feed with my agent and it flagged a few issues:

  • A broken or unreadable .aegiconf file can stop a subtitle from opening at all. Some fallback would be good.
  • Recovery autosaves can lose their media links. Opening one re-runs config discovery from the autosave folder instead of the project folder.
  • The two new preferences interact badly. One combo silently reverts saved changes on reopen. Another combo saves settings nowhere.
  • Saving writes sidecar files for non-ASS formats like SRT.
  • Opening a video silently marks timecodes and keyframes as cleared, and that sticks in the sidecar.
  • Pattern matching differs across platforms, like case sensitivity and bracket handling.
  • The Windows mount point check misses cross-volume directory symlinks.
  • Timecodes and keyframes erases get clobbered by the restore logic, which is fragile.
  • Audio from video can leave a stale "?video" reference after closing the video.
  • Automation Scripts paths are not resolved in recovery files.
  • Error messages don't say which config file failed.
  • If config saving fails after the subtitle is written, the user is told the save failed with no detail.

Comment thread src/subtitle_format_ass.cpp Resolved
}

agi::fs::path ProjectProperties::ConfigFilename(agi::fs::path const& subtitle) {
return subtitle.parent_path() / (".aegiconf-" + subtitle.filename().string());

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure having this be a dotfile is the best idea when most platforms hide dotfiles in the file explorer by default. While it is cleaner to have them hidden, having visible files ensures the user knows they exist (and can rename/delete them when renaming/deleting the ass file)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Being hidden (and thus unobtrusive) by default is the point. Could equivalently put it in a database in the user data dir, but this seemed cleaner. I suppose the rename concern is valid, but imo it's fairly minor (nothing in project garbage is that important), and renaming stuff willy-nilly has gotten a lot less common in the git era anyway.

@rcombs
rcombs force-pushed the codex/aegiconf branch 4 times, most recently from cae513e to 28093c5 Compare November 8, 2026 01:42
Save to .aegiconf-[full filename] by default without freezing pattern-derived paths. Preserve editable config content, provide a legacy inline save preference, and embed resolved project settings in recovery autosaves.
Keep the format factory registry in its own translation unit so focused ASS tests can link shared format operations without requiring every subtitle format implementation.
Cover cascading precedence, subtitle-relative media paths and patterns, Git discovery boundaries, ordered matching, and config persistence. Document the preferences and recovery autosave behavior.

This branch has not been deployed

No deployments
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.

3 participants