加载 autoload 的错误

重新安装了下配置,出现如下加载 autoloads 的错误:

Error loading autoloads: (file-missing Cannot open load file No such file or directory /Users/shamiliamarakoon/.emacs.d/elpa/request-20230127.417/request-autoloads)
Error loading autoloads: (file-missing Cannot open load file No such file or directory /Users/shamiliamarakoon/.emacs.d/elpa/zotxt-20240203.647/zotxt-autoloads)
Error loading autoloads: (file-missing Cannot open load file No such file or directory /Users/shamiliamarakoon/.emacs.d/elpa/yaml-20231211.1501/yaml-autoloads)
Error loading autoloads: (file-missing Cannot open load file No such file or directory /Users/shamiliamarakoon/.emacs.d/elpa/websocket-20230809.305/websocket-autoloads)
Error loading autoloads: (file-missing Cannot open load file No such file or directory /Users/shamiliamarakoon/.emacs.d/elpa/org-roam-20240703.1856/org-roam-autoloads)
Error loading autoloads: (file-missing Cannot open load file No such file or directory /Users/shamiliamarakoon/.emacs.d/elpa/elgrep-20230814.1215/elgrep-autoloads)
Error loading autoloads: (file-missing Cannot open load file No such file or directory /Users/shamiliamarakoon/.emacs.d/elpa/obsidian-20231218.1043/obsidian-autoloads)
Error loading autoloads: (file-missing Cannot open load file No such file or directory /Users/shamiliamarakoon/.emacs.d/elpa/markdown-toc-20210905.738/markdown-toc-autoloads)
Error loading autoloads: (file-missing Cannot open load file No such file or directory /Users/shamiliamarakoon/.emacs.d/elpa/grip-mode-20230206.323/grip-mode-autoloads)
Error loading autoloads: (file-missing Cannot open load file No such file or directory /Users/shamiliamarakoon/.emacs.d/elpa/ess-20240516.811/ess-autoloads)Error loading autoloads: (file-missing Cannot open load file No such file or directory /Users/shamiliamarakoon/.emacs.d/elpa/cdlatex-20231118.645/cdlatex-autoloads)
Error loading autoloads: (file-missing Cannot open load file No such file or directory /Users/shamiliamarakoon/.emacs.d/elpa/auctex-14.0.6/auctex-autoloads)
Error loading autoloads: (file-missing Cannot open load file No such file or directory /Users/shamiliamarakoon/.emacs.d/elpa/atomic-chrome-20230304.112/atomic-chrome-autoloads)

请教下,这个错误是怎么引起的,应该怎么解决?谢谢 ~

load-path自己改过吗?

谢谢大佬,没改过呢 :grinning: 一般也不动这个是吧:

(defun update-load-path (&rest _)
  "To update 'load-path'."
  (dolist (path '("lisp" "site-lisp"))
    (push (expand-file-name path user-emacs-directory) load-path)))

这个问题的出现是在重新安转配置: GPE

  • 删掉自己的配置,重新安装 (开小差多半年了,又用了回来)
  • 找了个朋友,试了一下,同样出现这个错误

现有的配置重置,没有相应的需要 autoload 的文件。比如 atomic-chrome-autoloads.el 文件。原来的有:

这个文件的源码如下:

;;; atomic-chrome-autoloads.el --- automatically extracted autoloads (do not edit)   -*- lexical-binding: t -*-
;; Generated by the `loaddefs-generate' function.

;; This file is part of GNU Emacs.

;;; Code:

(add-to-list 'load-path (or (and load-file-name (directory-file-name (file-name-directory load-file-name))) (car load-path)))



;;; Generated autoloads from atomic-chrome.el

(autoload 'atomic-chrome-start-server "atomic-chrome" "\
Start websocket server for atomic-chrome.
Fails silently if a server is already running." t)
(autoload 'atomic-chrome-stop-server "atomic-chrome" "\
Stop websocket server for atomic-chrome." t)
(register-definition-prefixes "atomic-chrome" '("atomic-chrome-" "global-atomic-chrome-edit-mode"))

;;; End of scraped data

(provide 'atomic-chrome-autoloads)

;; Local Variables:
;; version-control: never
;; no-byte-compile: t
;; no-update-autoloads: t
;; no-native-compile: t
;; coding: utf-8-emacs-unix
;; End:

;;; atomic-chrome-autoloads.el ends here

显示由 loaddefs-generate 生成。

现在的疑问:

  1. 为什么会生成这个文件?
  2. 这个文件是怎么生成的?

加快emacs启动速度,旧版emacs用update-file-autoloads生成,如

(update-file-autoloads 
 "~/.emacs.d/lisp/my-search.el" t 
 "~/.emacs.d/lisp/my-search-autoloads.el")

新版emacs删除了update-file-autoloads 这个函数,改用loaddefs-generate来生成,但我还没用上,不是很清楚用法

谢谢大佬 @wsug

新版emacs删除了update-file-autoloads 这个函数,改用loaddefs-generate来生成,但我还没用上,不是很清楚用法

这么说, package 被 调用所生成的相应 autoloads, 从而加快了 Emacs 启动速度。查了下 features (没有错误出现时的配置):

配置使用 use-package,这个错误的原因是不是这些 package 还没有被触发而产生的相应 autoload?

是如何按照的包?用 package-reinstall 重新安装,再看看有没有autoload文件

1 个赞

谢谢大佬@seagle0128,也是用 use-package 管理的:

;; Emacs for Overleaf
(use-package atomic-chrome
  :ensure t
  :config ; :init
  (atomic-chrome-start-server))

重新安装,也没有相应的autoload文件:

但是,别的有:

查了一下 custom.el (有 atomic-chrome):

但又不出现在 features 中 (比如:atomic-chrome-autoloads)

但错误提示包含了这个 (automic-chrome-autoloads)

错误可能是由于 treesit 引起的。

将 elpa 给删除掉,逐渐加载配置文件。就定位到 treesit,出现如下错误提示:

Error (use-package): Failed to install org-roam: Cannot load language definition: not-found, ("libtree-sitter-elisp.so" "libtree-sitter-elisp.so.0" "libtree-sitter-elisp.so.0.0" "libtree-sitter-elisp.dylib" "libtree-sitter-elisp.dylib.0" "libtree-sitter-elisp.dylib.0.0"), "No such file or directory"

可能是因为这个出错的缘故,之后的包,use-package 能安装,却不能生成相应的 autoload 的文件。导致加载 elpa 这个文件夹,找不到某些包相应的 autoload 文件,让 Emacs 调用。

treesit 这个 feature 不 require, 就解决了这个 autoload 的错误。

或许,elisp 相应的源需要更新下:

(elisp . ("https://github.com/Wilfred/tree-sitter-elisp"))

我这里是有的,你的应该是启动被打断了没安装成功

image

是啊,应该是被打断了,而没有接着生成相应的 autoload. 现在禁用 treesit 后就正常了。