Need
Default emacs font for most buffers is okay. But for coding-related activities I need a smaller, crisp font.
What works
In the spirit of Is it possible to change the font size in specific buffers? - Emacs Stack Exchange I've followed https://www.emacswiki.org/emacs/FacesPerBuffer and it works for most modes.
Those work very well:
(add-hook 'emacs-lisp-mode-hook 'my-buffer-face-mode-fixed)
(add-hook 'graphviz-dot-mode-hook 'my-buffer-face-mode-fixed)
(add-hook 'text-mode-hook 'my-buffer-face-mode-fixed)
(add-hook 'c-mode-hook 'my-buffer-face-mode-fixed)
(add-hook 'c++-mode-hook 'my-buffer-face-mode-fixed)
(add-hook 'objc-mode-hook 'my-buffer-face-mode-fixed)
(add-hook 'cmake-mode-hook 'my-buffer-face-mode-fixed)
(add-hook 'compilation-mode-hook 'my-buffer-face-mode-fixed)
(add-hook 'shell-dirtrack-mode-hook 'my-buffer-face-mode-fixed)
...(and many others)...
What fails
When using M-x gdb
, a multi-buffer interface appears, and I can't set the font for them.
describe-mode
reports Gdb-Many-Windows
and many others.
So I added
(add-hook 'gdb-many-windows-hook 'my-buffer-face-mode-fixed)
But it had no effect.
Then browsed https://github.com/Hawstein/my-emacs/blob/master/_emacs/multi-gdb-ui.el and added all the lines below, to hook, well, on every hook visible in that source code:
(add-hook 'prog-mode-hook 'my-buffer-face-mode-fixed)
(add-hook 'gdb-local-mode-hook 'my-buffer-face-mode-fixed)
(add-hook 'gdba-mode-hook 'my-buffer-face-mode-fixed)
(add-hook 'gdb-breakpoints-mode-hook 'my-buffer-face-mode-fixed)
(add-hook 'gdb-frames-mode-hook 'my-buffer-face-mode-fixed)
(add-hook 'gdb-threads-mode-hook 'my-buffer-face-mode-fixed)
(add-hook 'gdb-registers-mode-hook 'my-buffer-face-mode-fixed)
(add-hook 'gdb-memory-mode-hook 'my-buffer-face-mode-fixed)
(add-hook 'gdb-info-locals-mode-hook 'my-buffer-face-mode-fixed)
(add-hook 'gdb-locals-mode-hook 'my-buffer-face-mode-fixed)
(add-hook 'gdb-assembler-mode-hook 'my-buffer-face-mode-fixed)
(add-hook 'global-ede-mode-hook 'my-buffer-face-mode-fixed)
Still no effect.
It's tedious to manually change font every time in the ~5 buffers at each gdb invocation.
What now?
How to set font for gdb
emacs interface buffers?
(set-frame-font "Envy Code R-9" nil t)
which sets font as global default for all frames, which include gdb-mi frames. But it's global, not specific to mode.