Skip to content

Commit 2274777

Browse files
authored
[222_43] 确认对话框 Scheme 侧优化为使用通用函数 (#2812)
1 parent b7bd031 commit 2274777

File tree

3 files changed

+13
-4
lines changed

3 files changed

+13
-4
lines changed

TeXmacs/progs/kernel/texmacs/tm-dialogue.scm

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,12 @@
3232
(user-ask (list prompt "question" (translate "yes") (translate "no")) k)
3333
(user-ask (list prompt "question" (translate "no") (translate "yes")) k))))
3434

35+
(define-public (user-simple-confirm prompt default cont)
36+
(let ((k (lambda (answ) (cont (yes? answ)))))
37+
(if default
38+
(user-ask (list prompt "question-no-cancel" (translate "yes") (translate "no")) k)
39+
(user-ask (list prompt "question-no-cancel" (translate "no") (translate "yes")) k))))
40+
3541
(define-public (user-url prompt type cont)
3642
(user-delayed (lambda () (choose-file cont prompt type))))
3743

TeXmacs/progs/texmacs/texmacs/tm-print.scm

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -77,10 +77,9 @@
7777
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
7878

7979
(define (user-confirm-open-pdf fname)
80-
(user-ask (list "Open PDF?" "question-no-cancel"
81-
(translate "no") (translate "yes"))
82-
(lambda (answ)
83-
(when (yes? answ) (preview-file fname)))))
80+
(user-simple-confirm "Open PDF?" #f
81+
(lambda (open?)
82+
(when open? (preview-file fname)))))
8483

8584
(tm-define (wrapped-print-to-file fname)
8685
(system-wait "Exporting, " (translate "please wait"))

devel/222_43.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@
77
4. 导出完成后弹出对话框
88
5. 预期:只有“是/否”(或等价两项)按钮,不出现“取消”。
99

10+
## 2026/02/11
11+
### What
12+
- Scheme 侧优化为使用通用函数
13+
1014
## 2026/02/10
1115
### What
1216
- 导出 PDF 后的确认对话框仅保留两项选择。

0 commit comments

Comments
 (0)