From dc7fcb64da4e7f2b07b6b962055c49dfe16a5c14 Mon Sep 17 00:00:00 2001 From: Manuel Giraud Date: Wed, 15 Sep 2021 15:32:32 +0200 Subject: [PATCH] more vc-read-backend. --- lisp/vc/vc.el | 25 +++++++------------------ 1 file changed, 7 insertions(+), 18 deletions(-) diff --git a/lisp/vc/vc.el b/lisp/vc/vc.el index b3a5ff01cf..c88a796e56 100644 --- a/lisp/vc/vc.el +++ b/lisp/vc/vc.el @@ -1157,10 +1157,11 @@ vc-compatible-state (eq p q) (and (member p '(edited added removed)) (member q '(edited added removed))))) -(defun vc-read-backend (prompt) - (intern - (completing-read prompt (mapcar #'symbol-name vc-handled-backends) - nil 'require-match))) +(defun vc-read-backend (prompt &optional backends) + (let ((backends (or backends vc-handled-backends))) + (intern + (completing-read prompt (mapcar #'symbol-name backends) + nil 'require-match)))) ;; Here's the major entry point. @@ -1373,14 +1374,7 @@ vc-next-action (defun vc-create-repo (backend) "Create an empty repository in the current directory." - (interactive - (list - (intern - (upcase - (completing-read - "Create repository for: " - (mapcar (lambda (b) (list (downcase (symbol-name b)))) vc-handled-backends) - nil t))))) + (interactive (list (vc-read-backend "Create repository for: "))) (vc-call-backend backend 'create-repo)) ;;;###autoload @@ -2888,12 +2882,7 @@ vc-switch-backend (cond ((null others) (error "No other backend to switch to")) (current-prefix-arg - (intern - (upcase - (completing-read - (format "Switch to backend [%s]: " def) - (mapcar (lambda (b) (list (downcase (symbol-name b)))) backends) - nil t nil nil (downcase (symbol-name def)))))) + (vc-read-backend "Switch to backend: " backends)) (t def)))))) (unless (eq backend (vc-backend file)) (vc-file-clearprops file) -- 2.33.0