From: David Kågedal Date: Wed, 19 Dec 2007 18:00:09 +0000 (+0000) Subject: Emacs mode: Add stgit-edit command X-Git-Tag: v0.15-rc1~348 X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~mdw/git/stgit/commitdiff_plain/0bca35c81b3718487aef6b8957b90d4aa27fe1b8 Emacs mode: Add stgit-edit command Signed-off-by: David Kågedal Signed-off-by: Karl Hasselström --- diff --git a/contrib/stgit.el b/contrib/stgit.el index 4282585..a344869 100644 --- a/contrib/stgit.el +++ b/contrib/stgit.el @@ -89,6 +89,7 @@ (define-key stgit-mode-map "p" 'previous-line) (define-key stgit-mode-map "n" 'next-line) (define-key stgit-mode-map "g" 'stgit-refresh) (define-key stgit-mode-map "r" 'stgit-rename) + (define-key stgit-mode-map "e" 'stgit-edit) (define-key stgit-mode-map "\C-r" 'stgit-repair) (define-key stgit-mode-map "C" 'stgit-commit) (define-key stgit-mode-map "U" 'stgit-uncommit) @@ -204,6 +205,30 @@ (defun stgit-show () (goto-char (point-min)) (diff-mode)))) +(defun stgit-edit () + "Edit the patch on the current line" + (interactive) + (let ((patch (if (stgit-applied-at-point) + (stgit-patch-at-point) + (error "This patch is not applied"))) + (edit-buf (get-buffer-create "*stgit edit*")) + (dir default-directory)) + (log-edit 'stgit-confirm-edit t nil edit-buf) + (set (make-local-variable 'stgit-edit-patch) patch) + (setq default-directory dir) + (let ((standard-output edit-buf)) + (stgit-run "edit" "--save-template=-" patch)))) + +(defun stgit-confirm-edit () + (interactive) + (let ((file (make-temp-file "stgit-edit-"))) + (write-region (point-min) (point-max) file) + (stgit-capture-output nil + (stgit-run "edit" "-f" file stgit-edit-patch)) + (with-current-buffer log-edit-parent-buffer + (stgit-refresh)))) + + (defun stgit-help () "Display help for the StGit mode." (interactive)