From d92771c8a3373ca48c9976a94838b280e330093a Mon Sep 17 00:00:00 2001 From: Kyle Meyer Date: Fri, 9 Dec 2016 22:09:00 -0500 Subject: Add magit-update-or-auto-commit command --- lisp/km-magit.el | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'lisp') diff --git a/lisp/km-magit.el b/lisp/km-magit.el index 9b6c3cd..d4af9d3 100644 --- a/lisp/km-magit.el +++ b/lisp/km-magit.el @@ -46,6 +46,18 @@ a proper commit." (interactive) (magit-run-git "commit" "--all" "--message=auto")) +(defun km/magit-update-or-auto-commit () + (interactive) + (let ((files (delete-dups (nconc (magit-modified-files) + (magit-staged-files))))) + (cl-case (length files) + (0 (user-error "No tracked files with changes")) + (1 + (magit-run-git "commit" "--all" "--message" + (concat (car files) ": Update"))) + (t + (km/magit-auto-commit))))) + ;;;###autoload (defun km/magit-show-commit-at-point (&optional choose-project) "Show commit point. -- cgit v1.2.3