How to implement a functionality in emacs to show the difference of contents between two files opened in two buffers? Kind of like revdiff when using mercurial.
Emacs has ediff
, which can diff two files. To use it, just do M-x ediff
, and specify the two files you want to diff.
BTW, if you want to see the differences between two blocks of text in the same buffer, you can do it as follows:
- make sure smerge-mode is loaded (e.g. M-x load-library RET smerge-mode RET
).
- go to the beginning of the first bloc, C-SPC
- go the beginning of the second bloc, C-SPC
- go to the end of the second bloc, M-x smerge-makeup-conflict RET
- then you can use C-c ^ R
or C-c ^ =
to view the differences.
Note that this works better if the two blocs are pretty much consecutive.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With