branch: elpa/aidermacs
commit f2173e5e5da46e6d3679d710ae9023f5b62246d6
Author: Kang Tu <[email protected]>
Commit: Kang Tu (aider) <[email protected]>
feat: Add function to show last commit message using Magit
---
aider.el | 11 ++++++++++-
1 file changed, 10 insertions(+), 1 deletion(-)
diff --git a/aider.el b/aider.el
index 4850810726..d17862ea3e 100644
--- a/aider.el
+++ b/aider.el
@@ -41,6 +41,16 @@ This function can be customized or redefined by the user."
(defalias 'aider-read-string 'aider-plain-read-string)
+;; New function to show the last commit using magit
+(defun aider-magit-show-last-commit ()
+ "Show the last commit message using Magit.
+If Magit is not installed, report that it is required."
+ (interactive)
+ (if (require 'magit nil 'noerror)
+ (let ((last-commit (magit-git-string "log" "-1" "--pretty=%B")))
+ (message "Last commit message: %s" last-commit))
+ (message "Magit is required to show the last commit.")))
+
;; Transient menu for Aider commands
;; The instruction in the autoload comment is needed, see
;; https://github.com/magit/transient/issues/280.
@@ -363,4 +373,3 @@ The command will be formatted as \"/ask \" followed by the
text from the selecte
(provide 'aider)
;;; aider.el ends here
-