ginqi7 / dictionary-overlay

Emacs 插件-辅助英文阅读
https://qiqijin.com/cn/dictionary-overlay.html
160 stars 15 forks source link

Debugger entered--Lisp error: (wrong-type-argument stringp nil) #65

Open xianbang2021 opened 1 year ago

xianbang2021 commented 1 year ago

安装后启动失败。以下是debug-init打开后的输出。系统:ubuntu22.04@wsl2

Debugger entered--Lisp error: (wrong-type-argument stringp nil) encode-coding-string(nil utf-8) dictionary-encode-charset(nil "") dictionary-do-search(nil "" dictionary-display-search-result) dictionary-new-search-internal(nil "" dictionary-display-search-result) dictionary-new-search((nil . "")) dictionary-lookup-definition() eval((dictionary-lookup-definition)) custom-initialize-reset(dictionary-overlay-lookup-with (funcall #'(closure (t) nil "" 'dictionary-lookup-definition))) custom-declare-variable(dictionary-overlay-lookup-with (funcall #'(closure (t) nil "" 'dictionary-lookup-definition)) "Look up word with fn." :group dictionary-overlay :type (function)) eval-buffer(#<buffer load-735152> nil "/home/zwf/.emacs.d/site-lisp/dictionary-overlay/di..." nil t) ; Reading at buffer position 7416 load-with-code-conversion("/home/zwf/.emacs.d/site-lisp/dictionary-overlay/di..." "/home/zwf/.emacs.d/site-lisp/dictionary-overlay/di..." nil t)

(dictionary-overlay)

apply(# dictionary-overlay nil) (prog1 (apply orig feature args) (if (and (not already-loaded) (memq feature features)) (progn (let ((time (sanityinc/time-subtract-millis (current-time) require-start-time))) (add-to-list 'sanityinc/require-times (list feature require-start-time time) t))))) (let ((already-loaded (memq feature features)) (require-start-time (and (not already-loaded) (current-time)))) (prog1 (apply orig feature args) (if (and (not already-loaded) (memq feature features)) (progn (let ((time (sanityinc/time-subtract-millis ... require-start-time))) (add-to-list 'sanityinc/require-times (list feature require-start-time time) t)))))) sanityinc/require-times-wrapper(# dictionary-overlay) apply(sanityinc/require-times-wrapper # dictionary-overlay) require(dictionary-overlay) eval-buffer(#<buffer load*-351775> nil "/home/zwf/.emacs.d/lisp/init-local.el" nil t) ; Reading at buffer position 3586 load-with-code-conversion("/home/zwf/.emacs.d/lisp/init-local.el" "/home/zwf/.emacs.d/lisp/init-local.el" t t)

(init-local nil t)

apply(# init-local (nil t)) (prog1 (apply orig feature args) (if (and (not already-loaded) (memq feature features)) (progn (let ((time (sanityinc/time-subtract-millis (current-time) require-start-time))) (add-to-list 'sanityinc/require-times (list feature require-start-time time) t))))) (let ((already-loaded (memq feature features)) (require-start-time (and (not already-loaded) (current-time)))) (prog1 (apply orig feature args) (if (and (not already-loaded) (memq feature features)) (progn (let ((time (sanityinc/time-subtract-millis ... require-start-time))) (add-to-list 'sanityinc/require-times (list feature require-start-time time) t)))))) sanityinc/require-times-wrapper(# init-local nil t) apply(sanityinc/require-times-wrapper # (init-local nil t)) require(init-local nil t) eval-buffer(#<buffer load*> nil "/home/zwf/.emacs.d/init.el" nil t) ; Reading at buffer position 4495 load-with-code-conversion("/home/zwf/.emacs.d/init.el" "/home/zwf/.emacs.d/init.el" t t) load("/home/zwf/.emacs.d/init" noerror nomessage) startup--load-user-init-file(#f(compiled-function () #<bytecode -0x80fd433f0380fec>) #f(compiled-function () #<bytecode -0x1f3c686ddc0ca9b5>) t) command-line() normal-top-level()

另外,之前曾经成功使用过。但是dictionary-lookup-definition一直不能用,说没有definition.不知如何解决?

ginqi7 commented 1 year ago

dictionary-lookup-definition 是 Emacs 内置的的一个词典,我也不太确定这是个什么问题。推荐使用其他的自用词典。

qingshuizheng commented 1 year ago

似乎不是dictionary-overlay的问题,是系统自带的dictionary-lookup-definition没配置好?你直接把光标放在一个词上,调用命令dictionary-lookup-definition可以用么?

@ginqi7 不知道是不是和你第一次使用时的情况是一样的? On Dec 9, 2022, 01:00 -0500, xianbang2021 @.***>, wrote:

@.***

Debugger entered--Lisp error: (wrong-type-argument stringp nil) encode-coding-string(nil utf-8) dictionary-encode-charset(nil "") dictionary-do-search(nil "" dictionary-display-search-result) dictionary-new-search-internal(nil "" dictionary-display-search-result) dictionary-new-search((nil . "")) dictionary-lookup-definition() eval((dictionary-lookup-definition)) custom-initialize-reset(dictionary-overlay-lookup-with (funcall #'(closure (t) nil "" 'dictionary-lookup-definition))) custom-declare-variable(dictionary-overlay-lookup-with (funcall #'(closure (t) nil "" 'dictionary-lookup-definition)) "Look up word with fn." :group dictionary-overlay :type (function)) eval-buffer(# nil "/home/zwf/.emacs.d/site-lisp/dictionary-overlay/di..." nil t) ; Reading at buffer position 7416 load-with-code-conversion("/home/zwf/.emacs.d/site-lisp/dictionary-overlay/di..." "/home/zwf/.emacs.d/site-lisp/dictionary-overlay/di..." nil t)

(dictionary-overlay)

apply(# dictionary-overlay nil) (prog1 (apply orig feature args) (if (and (not already-loaded) (memq feature features)) (progn (let ((time (sanityinc/time-subtract-millis (current-time) require-start-time))) (add-to-list 'sanityinc/require-times (list feature require-start-time time) t))))) (let* ((already-loaded (memq feature features)) (require-start-time (and (not already-loaded) (current-time)))) (prog1 (apply orig feature args) (if (and (not already-loaded) (memq feature features)) (progn (let ((time (sanityinc/time-subtract-millis ... require-start-time))) (add-to-list 'sanityinc/require-times (list feature require-start-time time) t)))))) sanityinc/require-times-wrapper(# dictionary-overlay) apply(sanityinc/require-times-wrapper # dictionary-overlay) require(dictionary-overlay) eval-buffer(# nil "/home/zwf/.emacs.d/lisp/init-local.el" nil t) ; Reading at buffer position 3586 load-with-code-conversion("/home/zwf/.emacs.d/lisp/init-local.el" "/home/zwf/.emacs.d/lisp/init-local.el" t t)

(init-local nil t)

apply(# init-local (nil t)) (prog1 (apply orig feature args) (if (and (not already-loaded) (memq feature features)) (progn (let ((time (sanityinc/time-subtract-millis (current-time) require-start-time))) (add-to-list 'sanityinc/require-times (list feature require-start-time time) t))))) (let* ((already-loaded (memq feature features)) (require-start-time (and (not already-loaded) (current-time)))) (prog1 (apply orig feature args) (if (and (not already-loaded) (memq feature features)) (progn (let ((time (sanityinc/time-subtract-millis ... require-start-time))) (add-to-list 'sanityinc/require-times (list feature require-start-time time) t)))))) sanityinc/require-times-wrapper(# init-local nil t) apply(sanityinc/require-times-wrapper # (init-local nil t)) require(init-local nil t) eval-buffer(# nil "/home/zwf/.emacs.d/init.el" nil t) ; Reading at buffer position 4495 load-with-code-conversion("/home/zwf/.emacs.d/init.el" "/home/zwf/.emacs.d/init.el" t t) load("/home/zwf/.emacs.d/init" noerror nomessage) startup--load-user-init-file(#f(compiled-function () #<bytecode -0x80fd433f0380fec>) #f(compiled-function () #<bytecode -0x1f3c686ddc0ca9b5>) t) command-line() normal-top-level() 另外,之前曾经成功士用过。但是dictionary-lookup-definition一直不能用,说没有definition.不知如何解决? — Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you are subscribed to this thread.Message ID: @.***>

qingshuizheng commented 1 year ago

@xianbang2021 我记得dictionary-lookup-definition是需要配置的,我只使用过一次,已经忘了怎么调试了。现在用的懒猫的popweb-dict-.el 系列。我以前写这几行代码的时候,测试的是youdao-dictionary, 截图里的几个你都可以试试。各种第三方词典写的能够获取光标下word的功能都能使用,一般命令名字都是 -at-point。 image

xianbang2021 commented 1 year ago

dictionary-lookup-definition 是 Emacs 内置的的一个词典,我也不太确定这是个什么问题。推荐使用其他的自用词典。

您好,我去源代码那边把dictionary-overlay-lookup-with 相关的全部注释掉了。可以启动和正常使用。 (比较奇怪的是:dictiionary-lookup-definition我手工调用是可以正常查询的,我使用的是dictd)

想请教一下:

  1. dictionay-overlay-lookup-with 欲调用的函数,和那个translator(local,sdcv等)是什么关系?
  2. local指的是什么查询程序?我在wsl2里边安装了sdcv,词典是简明edict。dictionary-overlay实际使用中,overlay上体现的查询结果和我sdcv手工查询的结果似乎不太一致。所以有点疑惑。
ginqi7 commented 1 year ago

dictionay-overlay-lookup-with 欲调用的函数,和那个translator(local,sdcv等)是什么关系?

dictionay-overlay-lookup-with 是作为查询单词详情的词典用的(如果你没有自己日常用的词典可以用它兜底,推荐你使用日常的Emacs词典查询详情)。其他的 translator 是用来展示括号里的解释。

local指的是什么查询程序?

local 是只本地缓存,会有一个 dictionary.json 的用户文件,会保存你查询过的单词的含义,下次直接展示它。

查询结果和我sdcv手工查询的结果似乎不太一致

这里的 sdcv 并不是调用你本机安装的sdcv。而是dictionary-overlay 自己内置了一个 sdcv 支持的词典,使用该词典查询的。