I'd like to be able to see visually whether a window is dedicated. Is there a way that I could add this information to the mode line?
Answering a mode-line question is like opening a Pandora's Box because there are a zillion ways to customize it and people use libraries such as Powerline, etc., and others use the built-in format. That being said, here is a minimal working example that will affect all windows without a subsequently defined
mode-line-format. To affect only one buffer, use
setq in the target buffer instead of
setq-default. To test this, first evaluate the code below, and then evaluate
(set-window-dedicated-p (selected-window) t) to turn dedication on and
(set-window-dedicated-p (selected-window) nil) to turn dedication off.
(setq-default mode-line-format '(:eval (if (window-dedicated-p) "DEDICATED" "NOT-DEDICATED")))