我正在使用 all-the-icons-dired 与
(use-package all-the-icons
:if (display-graphic-p)
:config
(add-hook 'dired-mode-hook 'all-the-icons-dired-mode))
如果我启动 emacs,图标就会加载。但如果开始使用
emacsclient -c .
,它根本不会加载。
Ubuntu - 22.04
emacs - 27.1
您已经忽略了如何运行服务器,但我假设您将 Emacs 作为守护进程运行,在这种情况下,您的问题是您正在测试
(display-graphic-p)
:
display-graphic-p is a byte-compiled Lisp function in `frame.el'.
(display-graphic-p &optional DISPLAY)
Return non-nil if DISPLAY is a graphic display.
Graphical displays are those which are capable of displaying several
frames and several different fonts at once. This is true for displays
that use a window system such as X, and false for text-only terminals.
DISPLAY can be a display name, a frame, or nil (meaning the selected
frame's display).
守护进程启动时,没有图形显示(没有图形框);所以任何在启动时需要的东西都会失败。
您可以使用
server-after-make-frame-hook
或 after-make-frame-functions
在创建框架时进行操作。