I'm having a problem with putting vdiff-refine-all-hunks or ediff-update-diffs into --eval for startup. Take vdiff as example, I'm calling it using:
emacs --eval "(progn (vdiff-files file1 file2) (vdiff-refine-all-hunks))"
Note the functionvdiff-refine-all-hunks
here acts just like ediff-update-diffs
in ediff, which actually highlights the difference. Without running these two function the diffs are almost plain text.
According to diff-mode: refine all hunks when opening a diff file?, I added function sit-for
before vdiff-refine-all-hunks
:
emacs --eval "(progn (vdiff-files file1 file2) (sit-for 3) (vdiff-refine-all-hunks))"
Which works. However the loading time of vdiff really differs for different size of file. Setting 3 seconds works for a relatively large files but is too wasteful for two small one.
I do not understand why it takes so much time for ediff/vdiff to warm up, and is there an existing nice way to avoid the problem?
Update:
By using vdiff-auto-refine, it works if put (setq vdiff-auto-refine t)
into init.el, or just implement it in eval:
emacs --eval "(progn (setq vdiff-auto-refine t) (vdiff-files file1 file2))
However, known issue is that it is still not working for emacsclient no matter I setq in init or include it in eval:
emacsclient -c --eval "(progn (setq vdiff-auto-refine t) (vdiff-files file1 file2))"