emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] externals/ellama 592e2c8981 5/8: Improve commit message generatio


From: ELPA Syncer
Subject: [elpa] externals/ellama 592e2c8981 5/8: Improve commit message generation
Date: Wed, 10 Jul 2024 18:58:03 -0400 (EDT)

branch: externals/ellama
commit 592e2c89810c0e28e38b6d306961a076b030c21d
Author: Sergey Kostyaev <sskostyaev@gmail.com>
Commit: Sergey Kostyaev <sskostyaev@gmail.com>

    Improve commit message generation
    
    This commit enhances the `ellama-generate-commit-message` function. It
    now uses `save-window-excursion` to ensure that the current window is
    properly restored after generating the commit message. This addresses
    potential issues with changes in the current window during the
    process.
---
 ellama.el | 31 ++++++++++++++++---------------
 1 file changed, 16 insertions(+), 15 deletions(-)

diff --git a/ellama.el b/ellama.el
index 4bdb8e476b..1969c28b37 100644
--- a/ellama.el
+++ b/ellama.el
@@ -1645,21 +1645,22 @@ the full response text when the request completes (with 
BUFFER current)."
 (defun ellama-generate-commit-message ()
   "Generate commit message based on diff."
   (interactive)
-  (let* ((default-directory
-         (if (string= ".git"
-                      (car (reverse
-                            (cl-remove
-                             ""
-                             (file-name-split default-directory)
-                             :test #'string=))))
-             (file-name-parent-directory default-directory)
-           default-directory))
-        (diff (with-temp-buffer
-                (vc-diff-internal
-                 nil (vc-deduce-fileset t) nil nil nil (current-buffer))
-                (buffer-substring-no-properties (point-min) (point-max)))))
-    (ellama-stream
-     (format ellama-generate-commit-message-template diff))))
+  (save-window-excursion
+    (let* ((default-directory
+           (if (string= ".git"
+                        (car (reverse
+                              (cl-remove
+                               ""
+                               (file-name-split default-directory)
+                               :test #'string=))))
+               (file-name-parent-directory default-directory)
+             default-directory))
+          (diff (with-temp-buffer
+                  (vc-diff-internal
+                   nil (vc-deduce-fileset t) nil nil nil (current-buffer))
+                  (buffer-substring-no-properties (point-min) (point-max)))))
+      (ellama-stream
+       (format ellama-generate-commit-message-template diff)))))
 
 ;;;###autoload
 (defun ellama-ask-line ()



reply via email to

[Prev in Thread] Current Thread [Next in Thread]