Closed serycjon closed 6 months ago
Interesting, thanks; I worried about that regexp replace going wrong. I don't see that behavior with the same filename, so it must be something about the tmp-file location on your system confusing things.
Can you mention the diff headers it had prior to vundo-diff--cleanup-diff-buffer
? I see it also left the file names in the diff call above. So it's not correctly recognizing those and replacing them.
with the call to vundo-diff--cleanup-diff-buffer
commented out:
diff -u --label \#\<buffer\ 15.py-vundo-diff-markedltV4fE\> --label \#\<buffer\ 15.py\> /tmp/buffer-content-G0Qe91 /tmp/buffer-content-iCyxJQ
--- #<buffer 15.py-vundo-diff-markedltV4fE>
+++ #<buffer 15.py>
@@ -74,4 +74,6 @@
for slot_id, (label, focal_length) in enumerate(box):
total += (1 + box_id) * (1 + slot_id) * focal_length
print(total)
-tnaoeun
\ No newline at end of file
+tnaoeun
+
+ontoeuh
\ No newline at end of file
Diff finished. Sat Dec 16 21:33:03 2023
with the cleanup:
vundo-diff: 15.py
diff -u --label \#\<buffer\ 15.py-vundo-diff-markedvaGqK2\> --label \#\<buffer\ 15.py\> /tmp/buffer-content-rC66Mo /tmp/buffer-content-4HZRRj
--- <15.py> [mod 5] (Parent)
That's very interesting, thanks. What system is this? It's using an interesting --label
option to diff
that I don't have (mine just mention the bare temp files).
My cleanup regexp indeed presumed a tab would appear after the file, but it does not for you (possibly because of --label
), so it was swallowing the entire diff. Please try my branch at https://github.com/jdtsmith/vundo/tree/fix-cleanup. I am also let-binding diff-use-labels=nil
to hopefully get your diff command looking right. Give a try and let me know how it goes.
Arch linux, diff (GNU diffutils) 3.10
After your fix it looks good I think:
vundo-diff: 15.py
diff -u [5] [6]
--- <15.py> [mod 5] (Parent)
+++ <15.py> [mod 6] (Current)
@@ -74,4 +74,6 @@
for slot_id, (label, focal_length) in enumerate(box):
total += (1 + box_id) * (1 + slot_id) * focal_length
print(total)
-tnaoeun
\ No newline at end of file
+tnaoeun
+
+ontoeuh
\ No newline at end of file
Diff finished. Sun Dec 17 01:28:08 2023
Great thanks.
I'm running into this too, I'm not too familier with rx-to-string, personally I'd prefer a regex literal e.g.
(re-search-forward (concat
"^"
;; Prefix.
"\\-\\-\\-[[:blank:]]+.*\n" ; '--- '
"\\+\\+\\+[[:blank:]]+.*\n") ; '+++ '
nil t 1)
You should check out rx
, it's a fantastic way to clarify regexes. rx-to-string
is just the runtime equivalent of the macro, when you have dynamic elements. See #86 for a fix (please let me know how that works for you).
That's very interesting, thanks. What system is this? It's using an interesting
--label
option todiff
that I don't have (mine just mention the bare temp files).My cleanup regexp indeed presumed a tab would appear after the file, but it does not for you (possibly because of
--label
), so it was swallowing the entire diff. Please try my branch at https://github.com/jdtsmith/vundo/tree/fix-cleanup. I am also let-bindingdiff-use-labels=nil
to hopefully get your diff command looking right. Give a try and let me know how it goes.
I was running into the same problem on macOs with diff 3.10 and this branch fixed the issue for me
See #86. Should be merged soon I hope.
Hi,
I have tried vundo, but the diff feature didn't work properly for me. It does work in![EmacsPgU29p](https://github.com/casouri/vundo/assets/3328599/ae3f3c5f-e8a4-491a-8d5d-d5abeec95711)
init.el
buffer, but it doesn't work in15.py
- the diff is not shown at all:After a bit of digging, I have found that the problem is caused by
vundo-diff--cleanup-diff-buffer
- before it is called, the diff is shown. Seems like an issue with the regexp:In particular, when I replace the greedy operators
+
and*
by their non-greedy variant:The diff is shown nicely:![Emacs5eP2WP](https://github.com/casouri/vundo/assets/3328599/06d6ec2d-635d-4534-af93-66c15363c0f9)
I don't know why this only happens in some buffers.