Repository navigation
Supertag V2 — v0.2.0
Supertag V2 — v0.2.0
Saving a large Org file no longer freezes Emacs. This release also fixes Tag renaming, adds default-value automation, and shows node bodies in Stream.
保存大的 Org 文件不再让 Emacs 卡住。本版本同时修复了 Tag 改名、新增了"默认值"自动化,并让 Stream 显示节点正文。
Highlights / 更新重点
- Faster saves: after you save, only the headings whose text changed are re-synced, instead of the whole file. Background parsing yields as soon as you type. The local database is written in a simpler native format. Measurements are in the comparison below.
- Renaming a Tag keeps the Tag:
supertag-tag-renameused to drop the Tag's aliases, description and parent, and left child Tags and automation rules pointing at the old Tag. It now keeps the record and updates every reference, rewrites the Tag inside query blocks, and lists everything in the preview before you confirm. Files with unsaved changes are refused instead of being saved for you. - Automation defaults:
:update-propertyaccepts:if-missing t, which writes the value only when the property is absent or empty. A new template, "Tag added -> set a default property", uses it. - Stream View: Tags are shown by name instead of by ID, each node shows the start of its body, and
vopens Node View without moving the cursor out of Stream. - Also includes the navigation, Discovery and view-command changes listed in
CHANGELOG.org.
保存后只重新同步内容有变化的标题;后台解析在你打字时让路;本地数据库改用更简单的格式写盘。Tag 改名现在保留别名、描述、父级,并更新子 Tag、自动化规则和查询块。:update-property 新增 :if-missing。Stream 显示 Tag 名称和节点正文。
The save lag, before and after / 保存卡顿的前后对比
In v0.1.1, saving a large Org file was followed by two freezes: one about a second after the save, while the file was re-synced, and another two seconds later, while the database was written. Emacs is single-threaded, so typing was blocked during both.
Measured in a GUI Emacs with only Supertag loaded (interpreted, not byte-compiled), on a 330,000-character Org file with 1,029 headings and a database of 1,883 nodes, changing a few characters and saving:
| Step after a save | v0.1.1 | v0.2.0 |
|---|---|---|
| Re-sync the saved file | 3,337 ms, of which 2,061 ms garbage collection | about 155 ms; about 380 ms for the first save of a file in a session |
| Write the database | 380 ms | 48 ms in batch mode (171 ms in the GUI before the format change; not re-measured in the GUI after it) |
| Typing during the re-sync | blocked until it finished | parsing stops and resumes when Emacs is idle |
What caused it, and what changed:
| Cause in v0.1.1 | Change in v0.2.0 |
|---|---|
| Changing one line re-parsed every heading in the file | Only headings whose own text or ancestor headings changed are parsed |
| The saved file was parsed twice, the second time to look for deleted nodes | Parsed once |
| Interpreted code rebuilt closures for every heading while scanning inline Tags | Named functions; cleaned titles cached for one parse |
| A single sync triggered about 11 garbage collections, a database write about 12 | Collection is deferred and runs once afterwards |
| The database was sorted into a line-per-entity format and canonicalized again to verify it | One printed Store, verified by reading it back and comparing every entity |
For reference, the last V1 release (v5.9.0) used the same save flow. In batch mode it parsed this file in about 190 ms and wrote this database in about 45 ms, against about 790 ms and 270 ms for v0.1.1. v0.2.0 is back in that range for the database write and below it for an incremental re-sync (about 65 ms of parsing).
Numbers come from one machine and one vault; yours will differ with file and database size.
v0.1.1 中,保存大文件后会出现两次卡顿:约 1 秒后重新同步该文件,再过 2 秒整库写盘。在 33 万字符、1029 个标题的文件上,重新同步从 3337 ms 降到约 155 ms(每次启动后某文件的第一次保存约 380 ms),写盘从 380 ms 降到 48 ms(批处理测得),同步期间打字不再被挡住。
Upgrade notes / 升级说明
- The local database format changes on the first save. Existing databases load as before and are rewritten automatically. Earlier Supertag versions cannot read the new file; the daily backup under
backups/keeps a copy in the old format. Git sync is not affected, because the database is not transported. - Restart Emacs after upgrading, and recompile if you byte-compile the package.
- The first save of each file in a session still parses the whole file; later saves are incremental. Set
supertag-sync-incremental-parseto nil to turn the incremental path off. - Renaming a Tag to one of its own aliases now succeeds and promotes the alias.
- Query blocks that name a Tag by symbol, multi-line
:queryvalues in dynamic blocks, and blocks that cannot be parsed are listed in the rename preview but not rewritten.
首次保存后本地数据库会转成新格式,旧版本无法读取;backups/ 下的每日备份保留了旧格式副本。升级后请重启 Emacs。
Verification / 验证
35 test suites, 1317 tests. One test in the add-link suite fails because its subprocess cannot locate TextUI in the development environment; it fails the same way on the previous release. compile-check.sh passes.