Linux 上的
(menu-bar-mode -1)
(tool-bar-mode -1)
(scroll-bar-mode -1)
好像也占用了 0.2s 左右的时间,不负责任的猜测两句,它是先将 menu-bar, tool-bar, scroll-bar 三者加载起来再关闭所以比较慢,如果 Emacs 用的是 master 的编译版本也就是版本号是 27.0 以上的,支持一个叫作 early-init.el 的配置文件,这个文件会在你加载图像元素以及包管理之前加载,可以将这三行配置放到这个文件里面以解决这三行配置占用太多时间的问题。
至于 early-init.el 文件的话,自己创建一下扔到 .emacs.d 目录下就可以了
附上 emacs 自带的文档
The file is called 'early-init.el', in 'user-emacs-directory'. It is
loaded very early in the startup process: before graphical elements
such as the tool bar are initialized, and before the package manager
is initialized. The primary purpose is to allow customizing how the
package system is initialized given that initialization now happens
before loading the regular init file (see below).
We recommend against putting any customizations in this file that
don't need to be set up before initializing installed add-on packages,
because the early init file is read too early into the startup
process, and some important parts of the Emacs session, such as
window-system and other GUI features, are not yet set up, which could
make some customization fail to work.
至于其他的优化手段,其实最简单粗暴的就是是用包管理(现在大家应该都是包管理了吧),对启动速度的提升还是蛮大的。
配置文件的优化不外乎延迟加载,比较简单的实现方式之一就是上面所说的 use-package, 论坛里有人进行了翻译,我贴下地址