magit icon indicating copy to clipboard operation
magit copied to clipboard

magit-revert-rev-file-buffer: Use set-auto-mode

Open elken opened this issue 2 years ago • 4 comments

For that newly-opened buffer to have syntax coloring this function briefly sets buffer-file-name and performs (normal-mode t). This, in turn, triggers related major-mode hooks, which at least in the case of lsp causes issues.

An attempt was made to resolve this in f331092df but it didn't seem to resolve the issue.

Because of how the buffers are named, set-auto-mode couldn't work out which mode to use; so this has been swapped around.

This PR is slightly more disruptive than the previous change, so I accept that I may have to make other changes :)

Closes https://github.com/doomemacs/doomemacs/pull/6309

elken avatar May 11 '22 15:05 elken

fyi, applying this patch makes syntax coloring not work (e.g. rustic-mode is not starting) 😢

Patryk27 avatar May 11 '22 15:05 Patryk27

fyi, applying this patch makes syntax coloring not work (e.g. rustic-mode is not starting) 😢

Are you sure? It was working fine for me and you said it was working before :p

elken avatar May 11 '22 15:05 elken

Are you sure?

Pretty sure, I've just tried it a few times :x

you said it was working before :p

Which I've then corrected by saying Ah wait, sorry - I think I've forgotten to undo my change before applying yours 😅

Patryk27 avatar May 11 '22 15:05 Patryk27

Okay, I'll keep this open but for now it may not work

elken avatar May 11 '22 15:05 elken

I'm closing this for now. Please ping me when you are ready.

tarsius avatar Sep 16 '22 16:09 tarsius

@tarsius This has been confirmed to be resolved either by doom or magit; so all's well in the end.

Apologies this was left hanging for so long

elken avatar Sep 18 '22 08:09 elken