summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKyle Meyer <kyle@kyleam.com>2016-08-31 21:50:45 -0400
committerKyle Meyer <kyle@kyleam.com>2016-08-31 21:50:45 -0400
commit552e3a5951840c082529ae1dd90304e2d37435d9 (patch)
tree94435ef5ad3f3d0e775565b9d04dbfccea1c4d28
parentd75cbf84469c429454c70a7d845d7a08d3d493d0 (diff)
downloademacs.d-552e3a5951840c082529ae1dd90304e2d37435d9.tar.gz
Add magit-stash-edit-message command
-rw-r--r--init.el3
-rw-r--r--lisp/km-magit.el12
2 files changed, 15 insertions, 0 deletions
diff --git a/init.el b/init.el
index 02330a2..4e529bf 100644
--- a/init.el
+++ b/init.el
@@ -1053,6 +1053,9 @@
?c "Create & checkout from current"
#'km/magit-branch-and-checkout-from-current)
+ (magit-define-popup-action 'magit-stash-popup
+ ?e "Edit message" #'km/magit-stash-edit-message)
+
(magit-define-popup-action 'magit-branch-popup
?K "Delete previous branch" #'km/magit-delete-previous-branch)
(magit-define-popup-action 'magit-branch-popup
diff --git a/lisp/km-magit.el b/lisp/km-magit.el
index 4ab9125..9b6c3cd 100644
--- a/lisp/km-magit.el
+++ b/lisp/km-magit.el
@@ -645,6 +645,18 @@ argument. Interactively, this can be accessed using the command
(interactive "P")
(km/magit-diff-visit-file prev-rev t))
+(defun km/magit-stash-edit-message (stash message)
+ "Change STASH's message to MESSAGE."
+ (interactive
+ (let* ((stash (magit-read-stash "Rename" t))
+ (old-msg (magit-git-string "show" "-s" "--format=%s" stash)))
+ (list stash (magit-read-string "Stash message" old-msg))))
+ (let ((commit (magit-rev-parse stash))
+ (inhibit-magit-refresh t))
+ (magit-stash-drop stash)
+ (magit-stash-store message "refs/stash" commit))
+ (magit-refresh))
+
(defun km/git-commit-turn-on-flyspell ()
"Like `git-commit-turn-on-flyspell', but don't check buffer initially."
(setq flyspell-generic-check-word-predicate