Next: Q3.4.1, Previous: Q3.3.4, Up: Customisation
You can use something like the following:
(add-hook 'lisp-mode-hook (lambda () (set-face-background 'modeline "red" (current-buffer))))
Then, when editing a Lisp file (i.e. when in Lisp mode), the modeline colors change from the default set in your init.el. The change will only be made in the buffer you just entered (which contains the Lisp file you are editing) and will not affect the modeline colors anywhere else.
Notes:
-hook
. eg. c-mode-hook,
c++-mode-hook, emacs-lisp-mode-hook (used for your
init.el or a xx.el file),
lisp-interaction-mode-hook (the ‘*scratch*’ buffer),
text-mode-hook, etc.
add-hook
, not (setq c-mode-hook xxxx)
,
otherwise you will erase anything that anybody has already put on the
hook.
(set-face-font 'modeline font)
,
eg. (set-face-font 'modeline "*bold-r-normal*140-100-100*"
(current-buffer))
if you wish the modeline font to vary based on the
current mode.
There are additional modeline faces, modeline-buffer-id
,
modeline-mousable
, and modeline-mousable-minor-mode
, which
you may want to customize.