summaryrefslogtreecommitdiff
path: root/lisp
diff options
context:
space:
mode:
authorKyle Meyer <kyle@kyleam.com>2016-12-09 22:09:00 -0500
committerKyle Meyer <kyle@kyleam.com>2016-12-09 22:09:00 -0500
commitd92771c8a3373ca48c9976a94838b280e330093a (patch)
tree9f56c8df0edac1dadfda19a9233b2f89d2c28254 /lisp
parent99c55ae7e1129a352d6d4db1a36f1c6eba3300f9 (diff)
downloademacs.d-d92771c8a3373ca48c9976a94838b280e330093a.tar.gz
Add magit-update-or-auto-commit command
Diffstat (limited to 'lisp')
-rw-r--r--lisp/km-magit.el12
1 files changed, 12 insertions, 0 deletions
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.