[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] master 61dfc2c: Provide completion in vc-git-stash-* comma
From: |
Charles A. Roelli |
Subject: |
[Emacs-diffs] master 61dfc2c: Provide completion in vc-git-stash-* commands |
Date: |
Wed, 21 Mar 2018 16:08:03 -0400 (EDT) |
branch: master
commit 61dfc2c283f83f17bd9c757d5b953099d09e8f8c
Author: Charles A. Roelli <address@hidden>
Commit: Charles A. Roelli <address@hidden>
Provide completion in vc-git-stash-* commands
* lisp/vc/vc-git.el (vc-git-stash-read-history)
(vc-git-stash-read): New history variable and function.
(vc-git-stash-show, vc-git-stash-apply, vc-git-stash-pop): Update
their interactive specifications.
---
lisp/vc/vc-git.el | 21 ++++++++++++++++++---
1 file changed, 18 insertions(+), 3 deletions(-)
diff --git a/lisp/vc/vc-git.el b/lisp/vc/vc-git.el
index 5456467..bf1b050 100644
--- a/lisp/vc/vc-git.el
+++ b/lisp/vc/vc-git.el
@@ -1481,9 +1481,24 @@ This command shares argument histories with \\[rgrep]
and \\[grep]."
(vc-git--call nil "stash" "save" name)
(vc-resynch-buffer root t t))))
+(defvar vc-git-stash-read-history nil
+ "History for `vc-git-stash-read'.")
+
+(defun vc-git-stash-read (prompt)
+ "Read a Git stash. PROMPT is a string to prompt with."
+ (let ((stash (completing-read
+ prompt
+ (split-string
+ (or (vc-git--run-command-string nil "stash" "list") "") "\n")
+ nil :require-match nil 'vc-git-stash-read-history)))
+ (if (string-equal stash "")
+ (user-error "Not a stash")
+ (string-match "address@hidden:digit:]]+}" stash)
+ (match-string 0 stash))))
+
(defun vc-git-stash-show (name)
"Show the contents of stash NAME."
- (interactive "sStash name: ")
+ (interactive (list (vc-git-stash-read "Show stash: ")))
(vc-setup-buffer "*vc-git-stash*")
(vc-git-command "*vc-git-stash*" 'async nil "stash" "show" "-p" name)
(set-buffer "*vc-git-stash*")
@@ -1493,13 +1508,13 @@ This command shares argument histories with \\[rgrep]
and \\[grep]."
(defun vc-git-stash-apply (name)
"Apply stash NAME."
- (interactive "sApply stash: ")
+ (interactive (list (vc-git-stash-read "Apply stash: ")))
(vc-git-command "*vc-git-stash*" 0 nil "stash" "apply" "-q" name)
(vc-resynch-buffer (vc-git-root default-directory) t t))
(defun vc-git-stash-pop (name)
"Pop stash NAME."
- (interactive "sPop stash: ")
+ (interactive (list (vc-git-stash-read "Pop stash: ")))
(vc-git-command "*vc-git-stash*" 0 nil "stash" "pop" "-q" name)
(vc-resynch-buffer (vc-git-root default-directory) t t))
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Emacs-diffs] master 61dfc2c: Provide completion in vc-git-stash-* commands,
Charles A. Roelli <=