0

When using emacs as daemon,

systemctl --user start emacs-27.service
emacsclient -c

and also the following directly:

emacs-27 --fg-daemon
emacsclient -c

the font config in :~/.emacs.d/init.el will not be used:

(set-face-attribute
 'default nil
 :font (font-spec :name "-CTDB-Fira Code-light-normal-normal-*-*-*-*-*-d-0-iso10646-1"
                  :weight 'normal
                  :slant 'normal
                  :size 10.0))
(when (display-graphic-p)
  (dolist (charset '(kana han symbol cjk-misc bopomofo))
  (set-fontset-font
   (frame-parameter nil 'font)
   charset
   (font-spec :name "-SINO-STFangsong-normal-normal-normal-*-*-*-*-*-*-0-iso10646-1"
              :weight 'normal
              :slant 'normal
              :size 12.0))))

but when run emacs directly(no daemon), it can.

emacs

how do I let it use font config when run as daemon?

/usr/lib/systemd/user/emacs-27.service:

[Unit]
Description=Emacs text editor
Documentation=info:emacs man:emacs(1) https://gnu.org/software/emacs/

[Service]
Type=notify
ExecStart=/usr/bin/emacs-27 --fg-daemon
ExecStop=/usr/bin/emacsclient-emacs-27 --eval "(kill-emacs)"
# The location of the SSH auth socket varies by distribution, and some
# set it from PAM, so don't override by default.
# Environment=SSH_AUTH_SOCK=%t/keyring/ssh
Restart=on-failure

[Install]
WantedBy=default.target

I'm using gentoo, and emerge -pqv give this:

[ebuild   R   ] app-editors/emacs-27.1-r3  USE="Xaw3d acl athena gmp gui inotify jpeg libxml2 png ssl systemd threads xft xpm zlib -alsa (-aqua) -cairo -dbus -dynamic-loading -games -gconf -gfile -gif -gpm -gsettings -gtk -gtk2 -gzip-el -harfbuzz -imagemagick -json -kerberos -lcms -livecd -m17n-lib -mailutils -motif (-selinux) -sound -source -svg -tiff -toolkit-scroll-bars -wide-int -xwidgets"

How to let emacs use font config in ~/.emacs.d/init.el to when run as daemon?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.