3

diff-mode shows differences by lines. I'm looking for a mode that could show a diff knowing that the diffed files are elisp sources, so they are full of sexps and therefore more specialized diff highlight could be used.

Is there a mode to show a diff between two sexps or better between two files that are elisp sources?

Example of what I have in mind, instead of the usual:

- (unless foo bar baz)
+ (when (foo bar) baz)

structural diff:

(+when+-unless- +(+foo bar+)+ baz)
  • I don't have an answer for you, but depending on what you really need, ediff (e.g. ediff-buffers) might help. – Drew May 17 '16 at 13:52
1

I find that the built-in ediff serves great for diffing sexps. As soon as you ignore whitespace, the changes in sexps become very clear.

(setq ediff-diff-options "-w --text")

A nice command to start with is ediff-regions-wordwise, which can be used to narrow the bounds of the stuff you diff.

If you want to diff two sexps very quickly in terms of keys pressed, in lispy-mode you can select the first sexp with xB and compare them with B from the second sexp.

| improve this answer | |

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.