Status-Detective-783 · 2022-03-22 20:03
I copied an org tree. Oops. I'm not sure if I made changes to one of them. What are one (or more) ways I might compare them? I suppose I could do this:
1. find a new buffer/file
2. copy and yank one tree to the new buffer, save it
3. copy and yank the other tree to the new buffer
4. do a `M-x ediff-current-file` or `diff-buffer-with-file`.
5. resolve differences in the main org file
6. kill the new buffer and delete the corresponding work file
I was just wondering if there were some more direct methods.
github-alphapapa · 2022-03-23 01:00
What you want to do is diff two regions. If there isn't already a function for that, you could write one that does the steps you described, using the contents of two regions.
Status-Detective-783 · 2022-03-23 01:43
Thanks. I actually found a potential answer to this on stackoverflow. I haven't tried it out though, ymmv. From https://stackoverflow.com/a/18106677:
___
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.
___
organic-bookworm · 2022-03-23 07:52
You could also use `ediff` for side-by-side diffs.
- Compare arbitrary regions
- `ediff-regions-wordwise`
- `ediff-regions-linewise`
Use `org-mark-subtree` to create regions.
- Compare buffers
- `ediff-buffers`
Use `C-u M-x org-tree-to-indirect-buffer` to create two buffers narrowed to trees.
These approaches don't require blocks of text to be consecutive.
Status-Detective-783 · 2022-03-23 17:56
Great, thanks!!!
exclaim_bot · 2022-03-23 17:57
>Great, thanks!!!
You're welcome!