Skip to content

Commit cec53d9

Browse files
authored
[201_41] 懒加载 (liii ocr) 模块 (#2659)
1 parent 6ddd38e commit cec53d9

File tree

3 files changed

+9
-3
lines changed

3 files changed

+9
-3
lines changed

TeXmacs/progs/generic/generic-edit.scm

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,7 @@
1717
(utils edit variants)
1818
(utils misc tooltip)
1919
(bibtex bib-complete)
20-
(source macro-search)
21-
(liii ocr)))
20+
(source macro-search)))
2221

2322
(tm-define (generic-context? t) #t) ;; overridden in, e.g., graphics mode
2423

@@ -240,6 +239,8 @@ ocr-paste
240239
(ocr-paste)
241240
|#
242241
(tm-define (ocr-paste)
242+
(when (not (defined? 'ocr-to-latex-by-cursor))
243+
(use-modules (liii ocr)))
243244
(with data
244245
(parse-texmacs-snippet (tree->string (tree-ref (clipboard-get "primary") 1)))
245246
(when (tree-is? (tree-ref data 0) 'image)
@@ -259,6 +260,8 @@ image-and-ocr-paste
259260
(when (tree-is? (tree-ref data 0) 'image)
260261
(kbd-paste)
261262
(kbd-return)
263+
(when (not (defined? 'ocr-to-latex-by-cursor))
264+
(use-modules (liii ocr)))
262265
(ocr-to-latex-by-cursor data))))
263266

264267
(tm-define (paste-as-html)
@@ -291,6 +294,8 @@ paste-as-texmacs
291294
|#
292295

293296
(tm-define (paste-as-texmacs)
297+
(when (not (defined? 'ocr-to-latex-by-cursor))
298+
(use-modules (liii ocr)))
294299
(with img-tree (tree-ref (clipboard-get "primary") 1)
295300
(cond ((tree-is? img-tree 'image)
296301
(ocr-to-latex-by-cursor img-tree))

TeXmacs/progs/generic/paste-widget.scm

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
(texmacs-module (generic paste-widget)
1414
(:use (generic generic-edit)
1515
(utils edit selections)
16-
(liii ocr)
1716
(kernel texmacs tm-convert)))
1817
(import (only (liii list) delete))
1918

devel/201_41.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@
1414
+ 使用 **插入图片****粘贴图片** 以外的方式,即除了 **Ctrl+Alt+v** 粘贴图片以及 **插入->图片->插入图片** 以外的任何方式向编辑器输入一张图片,这里建议的方法是直接将文件夹中的图片拖入 Mogan,这样会插入一个没有经过处理的,能够稳定弹出警告的图片。插入后将鼠标移入移出图片范围,查看控制台是否正常输出 **std-warning**,而不是 **too many arguments...**
1515
+ 截图,进入数学模式,粘贴之后会得到`E=m*c^2`
1616

17+
## 2026/01/22 懒加载 (liii ocr) 模块
18+
1719
## 2026/01/07 修复数学模式下OCR粘贴
1820

1921
## 2026/01/07 添加OCR相关翻译

0 commit comments

Comments
 (0)