0

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))"
2

vdiff processes the output of diff asynchronously which takes a nonzero amount of time. Instead of guessing when to run vdiff-refine-all-hunks just set vdiff-auto-refine to t to let vdiff run it at the right time.

If you're having a performance issue, first check how long diff takes on the command line, then see if refining all hunks is slow, and finally report it to me on github if something seems off.

For all of the above ediff does comparable operations in the background explaining the similarities.

  • It generally works, but for unknown reason, it does not work in emacsclient eval no matter how I tried which still kind of bugs me. – phonycollectibles Jan 16 '17 at 12:55
  • What does "it" refer to? – justbur Jan 16 '17 at 13:17
  • (setq vdiff-auto-refine t) – phonycollectibles Jan 16 '17 at 13:30
  • Yes, there is something weird about emacsclient. vdiff is active for me and M-x vdiff-refresh fixes it right away, but I'm not sure what's going on right now. Open an issue here if you want me to look when I get time. – justbur Jan 16 '17 at 17:23
  • Please refer to github.com/justbur/emacs-vdiff/issues/13 – phonycollectibles Jan 24 '17 at 19:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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