一个支持多词典的翻译插件(目前仅支持单词)

In GNU Emacs 30.0.50 (build 1, x86_64-w64-mingw32) of 2024-05-07 built on ...
Repository revision: c2bca6fe0f1c191444d2dc632190706b2a5b663d
Repository branch: master

是最近的一个commit,最近两天的commit在windows编译失败就没试。编译失败是指用package.el安装的时候byte-compile失败,报错信息只有

ol-fanyi.el:32:11: Error: Symbol’s function definition is void: nil

如果手动去eval ol-fanyi.el这个文件,会报错,但是这个报错信息似乎和ol-fanyi.el又没有直接关系 :melting_face:

Debugger entered--Lisp error: (void-function nil)
  nil((fanyi-base-service) fanyi-haici-provider)
  widget-apply((fanyi-base-service) :match fanyi-haici-provider)
  widget-match-inline((fanyi-base-service) (fanyi-haici-provider fanyi-youdao-thesaurus-provider))
  widget-editable-list-match-inline((repeat :args ((fanyi-base-service))) (fanyi-haici-provider fanyi-youdao-thesaurus-provider))
  widget-editable-list-match((repeat :args ((fanyi-base-service))) (fanyi-haici-provider fanyi-youdao-thesaurus-provider))
  widget-apply((repeat :args ((fanyi-base-service))) :match (fanyi-haici-provider fanyi-youdao-thesaurus-provider))
  setopt--set(fanyi-providers (fanyi-haici-provider fanyi-youdao-thesaurus-provider))
  #f(lambda () [t] (setopt--set 'fanyi-providers '(fanyi-haici-provider fanyi-youdao-thesaurus-provider)))()
  eval-after-load-helper("e:/home/.config/emacs/elpa/fanyi-20230926.1849/fanyi.elc")
  run-hook-with-args(eval-after-load-helper "e:/home/.config/emacs/elpa/fanyi-20230926.1849/fanyi.elc")
  do-after-load-evaluation("e:/home/.config/emacs/elpa/fanyi-20230926.1849/fanyi.elc")
  require(fanyi)
  eval-buffer()  ; Reading at buffer position 1174
  funcall-interactively(eval-buffer)
  call-interactively(eval-buffer record nil)
  command-execute(eval-buffer record)
  execute-extended-command(nil "eval-buffer" nil)
  funcall-interactively(execute-extended-command nil "eval-buffer" nil)
  call-interactively(execute-extended-command nil nil)
  command-execute(execute-extended-command)

M-x fanyi-dwim 时的报错:

Debugger entered--Lisp error: (void-function nil)
  nil((fanyi-base-service) fanyi-haici-provider)
  widget-apply((fanyi-base-service) :match fanyi-haici-provider)
  widget-match-inline((fanyi-base-service) (fanyi-haici-provider fanyi-youdao-thesaurus-provider))
  widget-editable-list-match-inline((repeat :args ((fanyi-base-service))) (fanyi-haici-provider fanyi-youdao-thesaurus-provider))
  widget-editable-list-match((repeat :args ((fanyi-base-service))) (fanyi-haici-provider fanyi-youdao-thesaurus-provider))
  widget-apply((repeat :args ((fanyi-base-service))) :match (fanyi-haici-provider fanyi-youdao-thesaurus-provider))
  setopt--set(fanyi-providers (fanyi-haici-provider fanyi-youdao-thesaurus-provider))
  #f(lambda () [t] (setopt--set 'fanyi-providers '(fanyi-haici-provider fanyi-youdao-thesaurus-provider)))()
  eval-after-load-helper("e:/home/.config/emacs/elpa/fanyi-20230926.1849/fanyi.elc")
  run-hook-with-args(eval-after-load-helper "e:/home/.config/emacs/elpa/fanyi-20230926.1849/fanyi.elc")
  do-after-load-evaluation("e:/home/.config/emacs/elpa/fanyi-20230926.1849/fanyi.elc")
  autoload-do-load((autoload "fanyi" "Translate WORD.\n\n(fn WORD)" t nil) fanyi-dwim)
  command-execute(fanyi-dwim)

找到原因了,是我配置的问题 :sweat_smile:,原因可能是最近emacs应该是改了set-opt,导致加载错误

(with-eval-after-load 'fanyi   ;把with-eval-after-load去掉就没问题了
(setopt fanyi-providers
          '(fanyi-haici-provider fanyi-youdao-thesaurus-provider)))