reddit / emacs

How to use Nerd fonts inside Shell-mode in Emacs?

eis3nheim · 2022-11-26 12:54
I have the font installed on my PC, and it works well with other terminals such as *Alacritty*, but when I open my shell via the `shell-mode` the prompt is not displayed correctly. [This is the view](https://imgur.com/a/F6VoTAo) of the prompt in `shell-mode`, it can't display the icons. Edit: After searching Emacs documentation, I came across chapter [14.19 How Text Is Displayed,](https://www.gnu.org/software/emacs/manual/html_mono/emacs.html#Text-Display) and was able to kind of pinpoint what the issue is: > On text terminals, characters that cannot be displayed using the terminal encoding are normally displayed as question signs. And from chapter [22.12 Coding Systems for Terminal I/O](https://www.gnu.org/software/emacs/manual/html_mono/emacs.html#Terminal-Coding): >The command `C-x RET t` (`set-terminal-coding-system`) specifies the coding system for terminal output. If you specify a character code for terminal output, all characters output to the terminal are translated into that coding system. I have changed the value of this command and changed the encoding to UTF-8 but still got no result. This is all that I have concluded, I am still an Emacs newbie, but I am trying to learn.
L-Szos · 2022-11-26 17:20
The emacs wiki has a page on setting faces/fonts per buffer: https://www.emacswiki.org/emacs/FacesPerBuffer
eis3nheim · 2022-11-26 17:42
Thank you. I had this function in my configuration: (defun my-buffer-face-mode-fixed () "Set a fixed width (monospace) font in current buffer." (interactive) (setq buffer-face-mode-face '(:family "FiraCode NF" :height 100)) (buffer-face-mode)) (add-hook 'shell-mode-hook 'my-buffer-face-mode-fixed) But, still didn't make any changes and the result is the same, the font did change but the “?” are still there.