所有图标都无法在 emacsclient 中加载

问题描述 投票:0回答:1

我正在使用 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
1个回答
0
投票

您已经忽略了如何运行服务器,但我假设您将 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
在创建框架时进行操作。

© www.soinside.com 2019 - 2024. All rights reserved.