branch: elpa/gptel
commit 0ce917a7f091eee7d2148ba53536816106f0a7b0
Author: Henrik Ahlgren <pa...@seestieto.com>
Commit: GitHub <nore...@github.com>

    gptel-rewrite: Diff buffers, not files (#731)
    
    * gptel-rewrite.el (gptel--rewrite-diff): Show the difference
    between buffers rather than file names.  Otherwise, if a) the
    buffer has never been saved, the error "No such file or
    directory" will occur, or b) if there are unsaved changes in
    the buffer, the diff output will not reflect those changes. (#553)
---
 gptel-rewrite.el | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/gptel-rewrite.el b/gptel-rewrite.el
index c4aade13da..8dec3cb57f 100644
--- a/gptel-rewrite.el
+++ b/gptel-rewrite.el
@@ -292,10 +292,7 @@ BUF is the buffer to modify, defaults to the overlay 
buffer."
               ((buffer-live-p ov-buf)))
     (require 'diff)
     (let* ((newbuf (gptel--rewrite-prepare-buffer ovs))
-           (diff-buf (diff-no-select
-                      (if-let* ((buf-file (buffer-file-name ov-buf)))
-                          (expand-file-name buf-file) ov-buf)
-                      newbuf switches)))
+           (diff-buf (diff-no-select ov-buf newbuf switches)))
       (with-current-buffer diff-buf
         (setq-local diff-jump-to-old-file t))
       (display-buffer diff-buf))))

Reply via email to