Dumb Diff is an Emacs package for fast arbitrary diffs. It will automatically show "word diffs."
Calling dumb-diff
will create two comparison buffers on top and one result buffer on the bottom. Every time you call dumb-diff
it will update the result buffer and show the UI. You can use dumb-diff-set-region-as-buffer1
and dumb-diff-set-region-as-buffer2
to copy the content of selected regions directly into the buffer without needed to call dumb-diff
first.
I often need to see the diff of arbitrary content that is either not in a file or is only part of one. For instance, I'll have a string somewhere in a file, and then someone will send me an edit for it. I have often found this situation awkward, so I made this. Similar functionality is somewhere in the ediff
package and elsewhere. See alternatives.
Dumb Diff uses your built-in diff
program against dynamically created temporary files. The diff
binary and its arguments are customizable via dumb-diff-bin-path
and dumb-diff-bin-args
.
It's available on MELPA: M-x package-install dumb-diff
(setq dumb-diff-on-set-show-diff-only t)
If using a set-region-as-bufferN, whent
will only show the diff result buffer whilenil
will show the comparison buffers and diff result buffer. (defaults tot
)(setq dumb-diff-clear-buffers-on-quit t)
Whent
, quitting dumb diff will clear the comparison and result buffers. (defaults tot
)
(use-package dumb-diff
:bind (("C-c d" . dumb-diff)
("C-c 1" . dumb-diff-set-region-as-buffer1)
("C-c 2" . dumb-diff-set-region-as-buffer2)
("C-c q" . dumb-diff-quit))
:ensure t)
I personally use use-package
together with hydra.
Potential alternative packages for emacs: