doom emacs里如果use-package 了一个包,怎么查有哪些其他包调了这个包?

之前运行正常,今天doom sync -u了一下,升级了一些包,其中包含 youdao-dictionary这个包,重启emacs后报了:

Symbol's function definition is void: auth-source-search

的错误,emacs --debug-init 的结果看起来是youdao包调用故障,但是我是没有直接use youdao这个包的,不知道有其他什么包调用了这个youdao,通过什么方式可以查出来呢?

求教,谢谢。

emacs --debug-init输出信息如下:

Debugger entered--Lisp error: (void-function auth-source-search)
  auth-source-search(:host "openapi.youdao.com" :max 1)
  #f(compiled-function () #<bytecode -0xa6e63f4241c3389>)()
  funcall(#f(compiled-function () #<bytecode -0xa6e63f4241c3389>))
  eval((funcall #'#f(compiled-function () #<bytecode -0xa6e63f4241c3389>)))
  custom-initialize-reset(youdao-dictionary-secret-key (funcall #'#f(compiled-function () #<bytecode -0xa6e63f4241c3389>)))
  custom-declare-variable(youdao-dictionary-secret-key (funcall #'#f(compiled-function () #<bytecode -0xa6e63f4241c3389>)) "Youdao dictionary Secret Key. You can get it from ..." :type string)
  byte-code("\300\301\302\303\304DD\305\306\307%\210\300\310\302\303\311DD\312\306\307%\207" [custom-declare-variable youdao-dictionary-secret-key funcall function #f(compiled-function () #<bytecode -0xa6e63f4241c3389>) "Youdao dictionary Secret Key. You can get it from ..." :type string youdao-dictionary-app-key #f(compiled-function () #<bytecode 0x1272cecba93c6b11>) "Youdao dictionary App Key. You can get it from ai...."] 6)
  load("/Users/mls/.emacs.d/.local/etc/@/init.29.elc" noerror nomessage nosuffix)
  (progn (load init-file-name 'noerror 'nomessage 'nosuffix))
  (if init-file-name (progn (load init-file-name 'noerror 'nomessage 'nosuffix)))
  (let ((init-file-name (file-name-concat doom-profile-dir (format "init.%d.elc" emacs-major-version)))) (setq user-init-file t) (if init-file-name (progn (load init-file-name 'noerror 'nomessage 'nosuffix))) (if (eq user-init-file t) (progn (signal 'doom-nosync-error (list init-file-name)))) (setq user-init-file (concat (string-remove-suffix ".elc" user-init-file) ".el")))
  (progn (let ((init-file-name (file-name-concat doom-profile-dir (format "init.%d.elc" emacs-major-version)))) (setq user-init-file t) (if init-file-name (progn (load init-file-name 'noerror 'nomessage 'nosuffix))) (if (eq user-init-file t) (progn (signal 'doom-nosync-error (list init-file-name)))) (setq user-init-file (concat (string-remove-suffix ".elc" user-init-file) ".el"))))
  (if init-file-user (progn (let ((init-file-name (file-name-concat doom-profile-dir (format "init.%d.elc" emacs-major-version)))) (setq user-init-file t) (if init-file-name (progn (load init-file-name 'noerror 'nomessage 'nosuffix))) (if (eq user-init-file t) (progn (signal 'doom-nosync-error (list init-file-name)))) (setq user-init-file (concat (string-remove-suffix ".elc" user-init-file) ".el")))))
  (condition-case error (if init-file-user (progn (let ((init-file-name (file-name-concat doom-profile-dir (format "init.%d.elc" emacs-major-version)))) (setq user-init-file t) (if init-file-name (progn (load init-file-name 'noerror 'nomessage 'nosuffix))) (if (eq user-init-file t) (progn (signal 'doom-nosync-error (list init-file-name)))) (setq user-init-file (concat (string-remove-suffix ".elc" user-init-file) ".el"))))) ((debug error) (display-warning 'initialization (format-message "An error occurred while loading `%s':\n\n%s%s%s\n\nTo ..." user-init-file (get (car error) 'error-message) (if (cdr error) ": " "") (mapconcat #'(lambda (s) (prin1-to-string s t)) (cdr error) ", ")) :warning) (setq init-file-had-error t)))
  (let ((debug-on-error debug-on-error-initial)) (condition-case error (if init-file-user (progn (let ((init-file-name (file-name-concat doom-profile-dir ...))) (setq user-init-file t) (if init-file-name (progn (load init-file-name ... ... ...))) (if (eq user-init-file t) (progn (signal ... ...))) (setq user-init-file (concat (string-remove-suffix ".elc" user-init-file) ".el"))))) ((debug error) (display-warning 'initialization (format-message "An error occurred while loading `%s':\n\n%s%s%s\n\nTo ..." user-init-file (get (car error) 'error-message) (if (cdr error) ": " "") (mapconcat #'(lambda ... ...) (cdr error) ", ")) :warning) (setq init-file-had-error t))) (or (eq debug-on-error debug-on-error-initial) (progn (setq debug-on-error-should-be-set t) (setq debug-on-error-from-init-file debug-on-error))))
  (let ((debug-on-error-from-init-file nil) (debug-on-error-should-be-set nil) (debug-on-error-initial (if (eq init-file-debug t) 'startup init-file-debug)) (inhibit-null-byte-detection t)) (let ((debug-on-error debug-on-error-initial)) (condition-case error (if init-file-user (progn (let ((init-file-name ...)) (setq user-init-file t) (if init-file-name (progn ...)) (if (eq user-init-file t) (progn ...)) (setq user-init-file (concat ... ".el"))))) ((debug error) (display-warning 'initialization (format-message "An error occurred while loading `%s':\n\n%s%s%s\n\nTo ..." user-init-file (get (car error) 'error-message) (if (cdr error) ": " "") (mapconcat #'... (cdr error) ", ")) :warning) (setq init-file-had-error t))) (or (eq debug-on-error debug-on-error-initial) (progn (setq debug-on-error-should-be-set t) (setq debug-on-error-from-init-file debug-on-error)))) (if debug-on-error-should-be-set (progn (setq debug-on-error debug-on-error-from-init-file))))
  startup--load-user-init-file@init-doom(#f(compiled-function () #<bytecode 0x155f396c086439>) #f(compiled-function () #<bytecode -0x1f3c61addc1ff775>) t)
  apply(startup--load-user-init-file@init-doom (#f(compiled-function () #<bytecode 0x155f396c086439>) #f(compiled-function () #<bytecode -0x1f3c61addc1ff775>) t))
  startup--load-user-init-file(#f(compiled-function () #<bytecode 0x155f396c086439>) #f(compiled-function () #<bytecode -0x1f3c61addc1ff775>) t)
  command-line()
  normal-top-level()

用 customize 设置变量会导致调用 defcustom 定义的默认值。建议给 youdao 作者报 bug @xuchunyang ,因为他用了 auth-source 的函数却没 require 对应的包。

虽然 customize 是推荐的设置变量的方式,但在有些包的作者写的变量设置本身就有问题的情况下,还不如用简单 setq 方便。

1 个赞

是的,我没注意。现在已经避免在 defcustom 中使用 auto-source 了,避免让用户启动时多加载一个包:

1 个赞