Recently the [change in vc-git in emacs](3572613550)
broke modeline state in remote files as it prepends a string in the
beginning and cannot retrieve relative file path to pass as git command
argument.
The fix here ensures that the prefix in the beginning of the file path
doesn't break the `(vc-state)` command by passing local file name of the
remote files.
Fix#463
Instead of (de)activating the modeline for the current buffer and a
couple of special-cased buffers, (de)activate it for all open buffers.
This:
1. Ensures that enabling/disabling the modeline at any point sets the
modeline everywhere.
2. We actually catch all buffers at start, regardless of startup order.
Without this patch, the "*Async-native-compile-log*" doesn't get a
modeline.
This looks nicer, and it also makes sure it is not possible to try to
draw an image with a negative height for the middle part (which might
happen if window-start and buffer-size are out of sync).
The cached bar segment is only updated if it is active (that is: the hud
is not active), and drawing the segment relies on the cache being
up-to-date. This could cause problems if the bar is reconfigured while
inactive, and then activated.
Fix this by updating the cache when drawing if not populated yet, and
changing `doom-modeline-refresh-bars` to unconditionally invalidate it.
Both the bar and hud segment were invalidating their cache from
`window-configuration-change-hook`, which should not be necessary: the
bar segment should not care about window configuration at all, and the
hud segment should detect buffer position changes correctly on redraw.
These extra invalidations mask problems like the one this commit fixes.
Remove the unnecessary invalidations.
Co-authored-by: Vincent Zhang <seagle0128@gmail.com>