diff options
author | Gustav Hållberg <gustav@gmail.com> | 2012-04-06 21:32:37 +0200 |
---|---|---|
committer | Gustav Hållberg <gustav@gmail.com> | 2012-04-07 21:46:28 +0200 |
commit | 724dba9c7f2ba8a0ba585b7d443637211aa56b33 (patch) | |
tree | a92760fc7645c581f54572df82dde2c05cea4d22 | |
parent | f8c77f23c0c6126839ca1bd36bee5af6f458e8b1 (diff) | |
download | stgit-724dba9c7f2ba8a0ba585b7d443637211aa56b33.tar.gz |
stgit.el: Do not tab complete on current branch for stgit-branch
Signed-off-by: Gustav Hållberg <gustav@gmail.com>
-rw-r--r-- | contrib/stgit.el | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/contrib/stgit.el b/contrib/stgit.el index 0e84644..73973e1 100644 --- a/contrib/stgit.el +++ b/contrib/stgit.el @@ -1758,13 +1758,15 @@ was modified with git commands (`stgit-repair')." (stgit-run "repair")) (stgit-reload)) -(defun stgit-available-branches (&optional all) +(defun stgit-available-branches (&optional all skip-current) "Returns a list of the names of the available stg branches as strings. -If ALL is not nil, also return non-stgit branches." +If ALL is not nil, also return non-stgit branches. +If SKIP-CURRENT is not nil, do not include the current branch." (let ((output (with-output-to-string (stgit-run "branch" "--list"))) - (pattern (format "^>?\\s-+%c\\s-+\\(\\S-+\\)" + (pattern (format "^%c\\s-+%c\\s-+\\(\\S-+\\)" + (if skip-current ?\ ?.) (if all ?. ?s))) (start 0) result) @@ -1776,8 +1778,7 @@ If ALL is not nil, also return non-stgit branches." (defun stgit-branch (branch) "Switch to or create branch BRANCH." (interactive (list (completing-read "Switch to branch: " - (stgit-available-branches)))) - + (stgit-available-branches nil t)))) (stgit-assert-mode) (when (equal branch (stgit-current-branch)) |