dandavison / magit-delta

Use delta (https://github.com/dandavison/delta) when viewing diffs in Magit
MIT License
285 stars 10 forks source link

No easy way to disable #28

Open Atemu opened 8 months ago

Atemu commented 8 months ago

I needed to take a look at some line ending diffs and promptly ran into https://github.com/dandavison/delta/issues/754 making it impossible to tell what's going on.

So as a workaround, I wanted to quickly disable magit-delta for the repo I was working on but I couldn't as it'd always re-enable itself in any new magit buffer (such as opening a diff).

This is due to the fact that it's enabled merely by adding a hook which are easy to work with as a user. I propose changing it to both a hook and a variable; the hook reading the variable to determine whether it should actually enable delta for this buffer. There should then be a global variable to disable magit-delta and perhaps a project-scoped one.

dandavison commented 8 months ago

Hi @Atemu, yes I see you're right. It's implemented as an Emacs minor mode and so in theory M-x magit-delta-mode should toggle it. But I see that it becomes reactivated. If you work on this, if possible, it would be good to bear in mind this PR, which I think might be touching the lines of code you are referring to: https://github.com/dandavison/magit-delta/pull/27