summaryrefslogtreecommitdiff
path: root/.emacs.d
diff options
context:
space:
mode:
authorSean Whitton <spwhitton@spwhitton.name>2022-09-15 18:53:42 -0700
committerSean Whitton <spwhitton@spwhitton.name>2022-09-15 19:01:41 -0700
commite94959de096d4a52afd50ad5466bff68a4ac283c (patch)
tree5bcafd0ec2475d441dd25f71e23c0b3dfb7dd219 /.emacs.d
parent19d5a2301a8532fda4c5e9d4043fc1c59bd2e80e (diff)
downloaddotfiles-e94959de096d4a52afd50ad5466bff68a4ac283c.tar.gz
add spw/eshell-git-abort & spw/eshell-git-continue
Diffstat (limited to '.emacs.d')
-rw-r--r--.emacs.d/init.el22
1 files changed, 22 insertions, 0 deletions
diff --git a/.emacs.d/init.el b/.emacs.d/init.el
index 9f4403c9..f957f9c6 100644
--- a/.emacs.d/init.el
+++ b/.emacs.d/init.el
@@ -3409,6 +3409,28 @@ mutt's review view, after exiting EDITOR."
(dired-noselect (project-root (project-current t)))
(vc-print-root-log)))
+(defun spw/eshell-find-git-subcommand (option)
+ (if-let ((subcommand
+ (save-excursion
+ (goto-char (point-max))
+ (and (re-search-backward
+ "\\bgit \\([a-z-]+\\) --\\(?:abort\\|continue\\)\\b"
+ nil t)
+ (match-string 1)))))
+ (spw/eshell-insert-and-send "git " subcommand ?\ option)
+ (user-error "Cannot determine what git command is in progress.")))
+
+(defun spw/eshell-git-abort ()
+ (interactive)
+ (spw/eshell-find-git-subcommand "--abort"))
+
+(defun spw/eshell-git-continue ()
+ (interactive)
+ (spw/eshell-find-git-subcommand "--continue"))
+
+(spw/feature-define-keys ((esh-mode eshell-mode-map))
+ "\C-z\C-c" spw/eshell-git-continue "\C-z\C-v" spw/eshell-git-abort)
+
;;;; Assorted packages