paw.el外语学习,高亮笔记,单词本,等一体的新插件(Emacs的蒙哥阅读器、LingQ)

目前遇到的问题: 1

第一次查询会超时,但实际上它已经发音了,但之后仍在Processing,而且这时基本动不了,要过几分钟才会切换到另一处点击,继续Processing

希望能有个简化的方法,能先跑起来 :sweat_smile:

那个processing是go-translate在工作,它是用了plz在后台curl翻译服务,理论上不会卡emacs,它只是timeout(可能需要代理,或者你单独用go-translate翻译一下看看能不能工作卡不卡),还有sdcv你装了吗,因为sdcv需要单独配置(sdcv本身查词要没问题),我这边测试过是不会卡Emacs的,全部都是用make-process来跑的。

卡住几分钟有点奇怪,方便(setq debug-on-error t)看看错误在哪里吗?

最新测试gif:

output

貌似你的字体也有问题,显示不了中文,换个字体试试,我用的是maple mono nf cn

Debugger entered--Lisp error: (emacsql-timeout "Query timed out" 30)
  signal(emacsql-timeout ("Query timed out" 30))
  #f(compiled-function (connection &optional timeout) "Block until CONNECTION is waiting for further input." #<bytecode 0x3bcf997301d6571>)(#<emacsql-sqlite-connection emacsql-sqlite-connection-f33434>)
  apply(#f(compiled-function (connection &optional timeout) "Block until CONNECTION is waiting for further input." #<bytecode 0x3bcf997301d6571>) #<emacsql-sqlite-connection emacsql-sqlite-connection-f33434> nil)
  emacsql-wait(#<emacsql-sqlite-connection emacsql-sqlite-connection-f33434>)
  #f(compiled-function (connection &rest rest) #<bytecode 0x83b0c6a58d09f98>)(#<emacsql-sqlite-connection emacsql-sqlite-connection-f33434> (:file "/home/sisu/org/paw.sqlite"))
  apply(#f(compiled-function (connection &rest rest) #<bytecode 0x83b0c6a58d09f98>) (#<emacsql-sqlite-connection emacsql-sqlite-connection-f33434> (:file "/home/sisu/org/paw.sqlite")))
  #f(compiled-function (&rest args) #<bytecode 0x24e89310fe0a5b8>)(#<emacsql-sqlite-connection emacsql-sqlite-connection-f33434> (:file "/home/sisu/org/paw.sqlite"))
  apply(#f(compiled-function (&rest args) #<bytecode 0x24e89310fe0a5b8>) #<emacsql-sqlite-connection emacsql-sqlite-connection-f33434> (:file "/home/sisu/org/paw.sqlite"))
  initialize-instance(#<emacsql-sqlite-connection emacsql-sqlite-connection-f33434> (:file "/home/sisu/org/paw.sqlite"))
  #f(compiled-function (class &rest slots) "Default constructor for CLASS `eieio-default-superclass'.\nSLOTS are the initialization slots used by `initialize-instance'.\nThis static method is called when an object is constructed.\nIt allocates the vector used to represent an EIEIO object, and then\ncalls `initialize-instance' on that object." #<bytecode -0xdd5cc5df202d19>)(emacsql-sqlite-connection :file "/home/sisu/org/paw.sqlite")
  apply(#f(compiled-function (class &rest slots) "Default constructor for CLASS `eieio-default-superclass'.\nSLOTS are the initialization slots used by `initialize-instance'.\nThis static method is called when an object is constructed.\nIt allocates the vector used to represent an EIEIO object, and then\ncalls `initialize-instance' on that object." #<bytecode -0xdd5cc5df202d19>) emacsql-sqlite-connection (:file "/home/sisu/org/paw.sqlite"))
  make-instance(emacsql-sqlite-connection :file "/home/sisu/org/paw.sqlite")
  emacsql-sqlite("/home/sisu/org/paw.sqlite")
  paw-db()
  paw-db-sql([:select * :from [:select [items:word items:exp status:content status:serverp status:note status:note_type status:origin_type status:origin_path status:origin_id status:origin_point status:created_at] :from items :inner :join status :on (= items:word status:word)] :where (or (= origin_path "~/tmp.org") (in origin_path []) (= serverp 1) (= serverp 4) (= serverp 5) (= serverp 6))])
  paw-candidates-by-origin-path-serverp()
  paw-show-all-annotations()
  paw-annotation-mode(toggle)
  funcall-interactively(paw-annotation-mode toggle)
  call-interactively(paw-annotation-mode record nil)
  command-execute(paw-annotation-mode record)
  execute-extended-command(nil "paw-annotation-mode" "paw-annotation-mode")
  funcall-interactively(execute-extended-command nil "paw-annotation-mode" "paw-annotation-mode")
  call-interactively(execute-extended-command nil nil)
  command-execute(execute-extended-command)

如上

什么版本的Emacs?SQL问题,看看paw-db-connector是什么,如果不是sqlite-builtin,可能你的Emacs太久了,不支持builtin sql,建议安装sqlite3.

搜索了半天也没找到怎么看 paw-db-connector (只知道它是 nil ):sweat_smile:,环境是wsl ubuntu , sqlite3 已安装, emacs 28.1

你要么升级到29,要么安装其他的sqlite包,我没旧版Emacs在手,你可以试试:

  "The database connector used by paw.
This must be set before `paw' is loaded.  To use an alternative
connector you must install the respective package explicitly.
The default is `sqlite', which uses the `emacsql-sqlite' library
that is being maintained in the same repository as `emacsql'
itself.
If you are using Emacs 29, then the recommended connector is
`sqlite-builtin', which uses the new builtin support for SQLite.
You need to install the `emacsql-sqlite-builtin' package to use
this connector.
If you are using an older Emacs release, then the recommended
connector is `sqlite-module', which uses the module provided by
the `sqlite3' package.  This is very similar to the previous
connector and the built-in support in Emacs 29 derives from this
module.  You need to install the `emacsql-sqlite-module' package
to use this connector.
For the time being `libsqlite3' is still supported.  Do not use
this, it is an older version of the `sqlite-module' connector
from before the connector and the package were renamed.
For the time being `sqlite3' is also supported.  Do not use this.
This uses the third-party `emacsql-sqlite3' package, which uses
the official `sqlite3' cli tool, which is not intended
to be used like this.  See https://nullprogram.com/blog/2014/02/06/."

升级到 29.3 了,贴下配置

;; 安装 emacsql 包
(unless (package-installed-p 'emacsql)
  (package-refresh-contents)
  (package-install 'emacsql))

(setq emacsql-sqlite-executable "/usr/bin/sqlite3")

;; 安装 compat 包
(unless (package-installed-p 'compat)
  (package-refresh-contents)
  (package-install 'compat))

;; 安装 gptel 包
(unless (package-installed-p 'gptel)
  (package-refresh-contents)
  (package-install 'gptel))

;; 安装 svg-lib 包
(unless (package-installed-p 'svg-lib)
  (package-refresh-contents)
  (package-install 'svg-lib))

;; 安装 posframe 包
(unless (package-installed-p 'posframe)
  (package-refresh-contents)
  (package-install 'posframe))

;; 安装 paw 包
(unless (package-installed-p 'paw)
  (package-refresh-contents)
  (package-install 'paw))

(setq org-directory "/home/sisu/org/")

(setq paw-db-file (expand-file-name "paw.sqlite" org-directory))

;; 设置 paw 包的配置
(setq paw-db-file (expand-file-name "paw.sqlite" org-directory))
(setq paw-ecdict-db (expand-file-name "ecdict.db" org-directory))
(setq paw-pbm-enable t)
(setq paw-detect-language-p t)
(setq paw-click-overlay-enable t)
(setq paw-annotation-read-only-enable t)

目前启动没报错,点击查词时返回

paw-get-sentence-or-line: Invalid function: (beg . end)

还是文件缺少基本包dash.el,都加上了。

可以的话,把dashs, 都装上。如果没装的话。不过我觉得应该装了,都来到这一步了。

终于跑起来了,虽然有点不一样

但还是很兴奋

2 个赞

pbm图是不是没下载?安装的时候要把images文件里面的图都下载下来才行。或者重装看看。

是的,图片目录没有下载回来,折腾了一圈,直接改手动了,现在有了 bbb

请问:

  1. 如何改成像示例图上的左右分屏(我复制的是github上的示例配置但没能重现)
  2. 字典是要逐个安装的?字典没有展开
  3. 发音和go-translate都快,但下面还是有一个卡住的Processing(也可能不是卡住,因为又看了下示例图上也是这样显示的)

默认用pop-to-buffer。如果要,左右分屏得用popup的插件,我用doom,自带的。

词典配置,看看paw-sdcv-dictionary-list。

那个processing不是卡住,只是打印,是go-transalte的问题,暂时不知道怎么解决。

或者之后我加一个不用pop-to-buffer的选项吧。

我再去安一个doom emacs , 看看效果 update: 似乎一样做不到示例效果

史诗级更新!完成了英语词汇等级高亮了,模仿的是LingQ,没跟蒙哥,我自己觉得不懂的单词一个颜色就够了。单词过滤直接用ecdict数据库(大家需要根据我README上的重新下载,还有安装一下nltk,不安装运行会出问题,ecdict的原版数据库是812Mb,有300多万单词)查询,在python端完成,然后再在emacs高亮(默认蓝色),每次切换buffer大概两秒内完成高亮,完全不卡Emacs。手机电脑同步更新,手机实测《经济学人》如下,欢迎尝鲜:

output

支持5大等级过滤:

5. Show/Highlight unknown words at the background
- Enable ~paw-annotation-show-unknown-words-p~
- Tweak five different filter settings to fit your need:
  + ~paw-ecdict-frq~: Minimal Frequency from frp, -1 means all
  + ~paw-ecdict-bnc~: Minimal Frequency from bnc, -1 means all
  + ~paw-ecdict-tags~: Tags for querying english words, set it part of: 'zk gk ky cet4 cet6 ielts toefl gre empty'.
  + ~paw-ecdict-oxford~: Whether within oxford 3000, 0 or 1, 1 means in oxford 3000
  + ~paw-ecdict-collins-max-level~: The max collins level, 1 to 5.

nov阅读epub的换页高亮,参考我的配置:shrface/config.el at master · chenyanming/shrface · GitHub

配合paw-view-notespaw-view-note-current-thing就可以做到提前预习的功能了。

以下是哈利波特原著测试图:

不拉选,高亮下,运行paw-view-notes,查看整个buffer、epub的笔记,包含当前buffer蓝色高亮

拉选后,运行paw-view-note-current-thing,同步蓝色高亮,快速查词:

2 个赞

LZ 有时间出个从零上手的教程吧,或者能有个像 Docker 的方案直接解包可用?