summaryrefslogtreecommitdiff
path: root/lisp
diff options
context:
space:
mode:
authorKyle Meyer <kyle@kyleam.com>2017-06-14 21:36:22 -0400
committerKyle Meyer <kyle@kyleam.com>2017-06-14 21:36:22 -0400
commitf48be9dcbb65836bea7d4a11763c52449ec81a00 (patch)
tree3d7dc6027d6b31f5703c1542cd7148f245f7edff /lisp
parent5b5989c8a7c738b26a4fc2d3e903c5a9156aced1 (diff)
downloademacs.d-f48be9dcbb65836bea7d4a11763c52449ec81a00.tar.gz
magit-update-or-auto-commit: Add optional no-directory argument
Diffstat (limited to 'lisp')
-rw-r--r--lisp/km-magit.el10
1 files changed, 7 insertions, 3 deletions
diff --git a/lisp/km-magit.el b/lisp/km-magit.el
index 81fa48a..1c84250 100644
--- a/lisp/km-magit.el
+++ b/lisp/km-magit.el
@@ -46,15 +46,19 @@ a proper commit."
(interactive)
(magit-run-git "commit" "--all" "--message=auto"))
-(defun km/magit-update-or-auto-commit ()
- (interactive)
+(defun km/magit-update-or-auto-commit (&optional no-directory)
+ (interactive "P")
(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")))
+ (concat (funcall (if no-directory
+ #'file-name-nondirectory
+ #'identity)
+ (car files))
+ ": Update")))
(t
(km/magit-auto-commit)))))