This question already has an answer here:
In Emacs, on the modeline: I would like the name of the currently focused buffer to be bold, but only when its window is selected.
My modeline looks something like this:
(setq mode-line-format (list "%&" " " (propertize "%b " 'face 'mode-line-buffer-id) "%p of %I" " " "[%l,%c]" 'vc-mode " " 'mode-line-modes ))
I would like "%b" (the name of the buffer) to be bold when its window is selected. I am totally new to Emacs Lisp. I thought setting the face to a variable that is changed by some "focus-in" hook would be the way to go (and possibly forcing the modeline to be redrawn).
I'm not sure what event I should hook in to. I know about focus-in-hook and focus-out-hook but those are for the frame.
Any hints are greatly appreciated.