Repository navigation
Conversation
…ound variable edit_mouse.cpp 直接 call 了 (link link-navigate) 模块里的 6 个符号,但 init-research.scm 的 lazy-define 只登记了其中 4 个。该模块是懒加载的:在被 其它入口加载之前,未登记的符号处于未绑定状态;鼠标划过 / 点击带 locus 的 元素时 C++ 先调到它们,S7 报 ";unbound variable ..."。 补齐仍缺的两个符号: - link-contains-inner-link? (mouse_select 中先于 link-follow-ids 被调用) - show-hlink-tooltip (mouse_any 的 hover 分支) link-mouse-ids 已在主干登记,本次不重复改动。 新增 headless 回归测试 TeXmacs/progs/link/tests/link-navigate-test.scm: 启动后、模块加载前断言全部 C++ 直调符号已有 lazy 桩,再验证首次调用能经桩 加载模块并正确执行。测试刻意不 load 被测模块,否则 (defined? ...) 失去区分度。 Fixes MoganLab#4552 Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
问题
Fixes #4552。鼠标划过 / 点击带 locus(链接 ID)的元素时,Scheme 运行时报
;unbound variable ...。根因
src/Edit/Interface/edit_mouse.cpp直接call了(link link-navigate)模块的 6 个符号,而TeXmacs/progs/init-research.scm的lazy-define只登记了其中 4 个。该模块是懒加载的:在被其它入口加载之前,未登记的符号处于未绑定状态;只要 C++ 先调到它们就报错。当前主干已登记
link-mouse-ids,仍缺两个:link-contains-inner-link?——mouse_select中在link-follow-ids之前被调用(edit_mouse.cpp:205),点击 locus 即可触发;show-hlink-tooltip——mouse_any的 hover 分支(edit_mouse.cpp:854)。改动
TeXmacs/progs/init-research.scm:(lazy-define (link link-navigate) ...)补齐上述两个符号(+2 行)。新增 headless 回归测试
TeXmacs/progs/link/tests/link-navigate-test.scm(xmake r link-navigate-test,xmake 自动发现):defined?(即已有 lazy 桩);断言携带符号名,失败时直接看出漏了谁;link-contains-inner-link?能经 lazy 桩加载模块并返回正确值(空列表 →#t);show-hlink-tooltip '()no-op 不抛错。测试刻意不
load/:use被测模块:一旦加载,所有符号都会被定义,defined?断言就失去区分度。覆盖面核查
用 grep 把
src/下全部call ("...")(198 个不同符号)与TeXmacs/progs中的tm-define交叉比对,再逐一排除:启动期已use-modules(含传递:use)的模块、C++ 侧先显式eval ("(use-modules ...)")再 call 的(utils misc version-update)、kernel 内已有默认定义的(speech-pause)。结果(link link-navigate)是唯一仍有缺口的懒加载模块,本 PR 补齐后无遗留。与 #4683 的关系
#4683(draft)思路一致。差异:它基于旧主干(会重复加入已登记的
link-mouse-ids);其link-navigate-test.scm通过(:use (link link-navigate))加载了被测模块,defined?断言恒真。本 PR 基于当前主干,测试不加载模块。若维护者倾向合并 #4683,本 PR 的测试部分可单独保留。测试说明
本机没有 xmake / gf 构建环境,未能本地执行
xmake r link-navigate-test与gf fmt,烦请以 CI 结果为准。改动仅为 Scheme 符号登记 + 新增测试文件,无 C++ 变更,不影响已登记符号的行为。🤖 Generated with Claude Code