In magit, it looks like that if I want to have a diff that highlight changing words, I can either press D t when I'm in the diff, or put in my .emacs

(custom-set-variables '(magit-diff-refine-hunk all))

However, it turns out that the changing words are highlighted only if I move the buffer cursor near to the line that changed. So for example if I have two changes in the file, then I need to move my cursor to the diff of the second part of the file to see the changes.

Can I set it up so that the refine diff is displayed across all the buffer ?

Thank you!

1 Answer 1


That's because you are not using custom-set-variables correctly. You are not supposed to write that by hand, but if you wrote it like this

(custom-set-variables '(magit-diff-refine-hunk (quote all)))

then it should work. But just use this instead

(setq magit-diff-refine-hunk 'all)

As mentioned by @Basil, you could also use custom-set-variable (singular), but that only makes sense if setting the option through the Custom interface would do something beside setting the variable, i.e. if the defcustom sets :initialize, :set or :set-after'. Since that isn't the case here you should just usesetq'.

  • 1
    FWIW, the hand-written version of custom-set-variables for a single variable is customize-set-variable.
    – Basil
    Commented Feb 5, 2018 at 21:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.