linwaytin · 2022-12-31 17:38
When I switch to another branch, I would like to see the mode line updates the branch name, but it only updates when I do some actions. I'm thinking about using `(run-with-idle-timer 0 1 #'(lambda () (force-mode-line-update t)))` to do this, is this correct? I'm also worried if this would cause performance issues. Or is there a better way to do this?
Thanks, and happy new year!
xtifr · 2022-12-31 20:38
I'm pretty sure that would cause performance issues, yes. Anyway, how are you switching branches? When I switch branches, the mode line automatically updates. Are you switching branches outside of Emacs somehow? Are you possibly even not using magit? If that's the case, the *correct* thing to do is *definitely* to *start* using magit! :) Otherwise...I guess we need to diagnose why your copy of magit isn't refreshing the mode line!
linwaytin · 2022-12-31 21:15
Yes, I usually switch branches in a terminal. I do use magit, but mainly for adding and committing changes.
Magit does not have `git switch`. This is annoying. How do you switch branches?
xtifr · 2022-12-31 22:10
With `b b` usually? I'm not familiar with `git switch`, but the docs say it's experimental and subject to change without notice, so it's not something I'd *want* magit to use *or* something I'd want to rely on for production code! But unless I'm missing something, it looks like it's just a convenience wrapper around the `git branch` and `git checkout` commands, so not exactly essential. Magit is *also* a convenience wrapper around various git commands! :)
linwaytin · 2022-12-31 22:49
It's good to know that it is still experimental. Thank you.
The problem is that I'm not a git expert, and when I have problems I just search online and paste the commands I find to the terminal. This is why I usually use terminals to handle git.
Anyway, thanks for your answer. I will try to learn more about magit!