From 35bb629eca9a60fb2cc9c7eaa953bf1b0dfc5860 Mon Sep 17 00:00:00 2001 From: Philip Kaludercic Date: Tue, 3 Oct 2023 09:55:12 +0200 Subject: [PATCH] Rename 'vc-switch-backend' to 'vc-change-backend' * etc/NEWS: Mention the change * lisp/vc/vc.el (vc-switch-backend): Rename and unobsolete. (vc-transfer-file): Use new name. (bug#50344) --- etc/NEWS | 4 ++++ lisp/vc/vc.el | 18 ++++++++---------- 2 files changed, 12 insertions(+), 10 deletions(-) diff --git a/etc/NEWS b/etc/NEWS index 12c2d52a4ab..8e05c668439 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -315,6 +315,10 @@ This is a string or a list of strings that specifies the Git log switches for shortlogs, such as the one produced by 'C-x v L'. 'vc-git-log-switches' is no longer used for shortlogs. +--- +*** Obsolete command 'vc-switch-backend' re-added as 'vc-change-backend'. +The command was previously obsoleted and unbound in Emacs 28. + ** Diff Mode +++ diff --git a/lisp/vc/vc.el b/lisp/vc/vc.el index b99424750e0..55d0376eab6 100644 --- a/lisp/vc/vc.el +++ b/lisp/vc/vc.el @@ -3171,14 +3171,13 @@ its name; otherwise return nil." (vc-resynch-buffer file t t)) ;;;###autoload -(defun vc-switch-backend (file backend) +(defun vc-change-backend (file backend) "Make BACKEND the current version control system for FILE. FILE must already be registered in BACKEND. The change is not permanent, only for the current session. This function only changes VC's perspective on FILE, it does not register or unregister it. By default, this command cycles through the registered backends. To get a prompt, use a prefix argument." - (declare (obsolete nil "28.1")) (interactive (list (or buffer-file-name @@ -3209,6 +3208,9 @@ To get a prompt, use a prefix argument." (error "%s is not registered in %s" file backend)) (vc-mode-line file))) +(define-obsolete-function-alias 'vc-switch-backend #'vc-change-backend + "30.1") + ;;;###autoload (defun vc-transfer-file (file new-backend) "Transfer FILE to another version control system NEW-BACKEND. @@ -3233,8 +3235,7 @@ backend to NEW-BACKEND, and unregister FILE from the current backend. (if registered (set-file-modes file (logior (file-modes file) 128)) ;; `registered' might have switched under us. - (with-suppressed-warnings ((obsolete vc-switch-backend)) - (vc-switch-backend file old-backend)) + (vc-change-backend file old-backend) (let* ((rev (vc-working-revision file)) (modified-file (and edited (make-temp-file file))) (unmodified-file (and modified-file (vc-version-backup-file file)))) @@ -3253,19 +3254,16 @@ backend to NEW-BACKEND, and unregister FILE from the current backend. (vc-revert-file file)))) (vc-call-backend new-backend 'receive-file file rev)) (when modified-file - (with-suppressed-warnings ((obsolete vc-switch-backend)) - (vc-switch-backend file new-backend)) + (vc-change-backend file new-backend) (unless (eq (vc-checkout-model new-backend (list file)) 'implicit) (vc-checkout file)) (rename-file modified-file file 'ok-if-already-exists) (vc-file-setprop file 'vc-checkout-time nil))))) (when move - (with-suppressed-warnings ((obsolete vc-switch-backend)) - (vc-switch-backend file old-backend)) + (vc-change-backend file old-backend) (setq comment (vc-call-backend old-backend 'comment-history file)) (vc-call-backend old-backend 'unregister file)) - (with-suppressed-warnings ((obsolete vc-switch-backend)) - (vc-switch-backend file new-backend)) + (vc-change-backend file new-backend) (when (or move edited) (vc-file-setprop file 'vc-state 'edited) (vc-mode-line file new-backend) -- 2.39.2