From f48be9dcbb65836bea7d4a11763c52449ec81a00 Mon Sep 17 00:00:00 2001 From: Kyle Meyer Date: Wed, 14 Jun 2017 21:36:22 -0400 Subject: magit-update-or-auto-commit: Add optional no-directory argument --- lisp/km-magit.el | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'lisp') 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))))) -- cgit v1.2.3