]> code.delx.au - gnu-emacs/blobdiff - lisp/vc/vc-hooks.el
Merge from emacs-24; up to 2014-07-17T10:18:19Z!dmantipov@yandex.ru
[gnu-emacs] / lisp / vc / vc-hooks.el
index 1cd297ae43ae48f89db7bb85ad37126565ad7e67..df660d193e281540b2735a6a9c3e247da38dfa19 100644 (file)
@@ -190,6 +190,11 @@ individually should stay local."
 (make-variable-buffer-local 'vc-mode)
 (put 'vc-mode 'permanent-local t)
 
+;;; We signal this error when we try to do something a VC backend
+;;; doesn't support.  Two arguments: the method that's not supported
+;;; and the backend
+(define-error 'vc-not-supported "VC method not implemented for backend")
+
 (defun vc-mode (&optional _arg)
   ;; Dummy function for C-h m
   "Version Control minor mode.
@@ -268,10 +273,10 @@ It is usually called via the `vc-call' macro."
       (setq f (vc-find-backend-function backend function-name))
       (push (cons function-name f) (get backend 'vc-functions)))
     (cond
-     ((null f)
-      (error "Sorry, %s is not implemented for %s" function-name backend))
-     ((consp f)        (apply (car f) (cdr f) args))
-     (t                (apply f args)))))
+      ((null f)
+       (signal 'vc-not-supported (list function-name backend)))
+      ((consp f)       (apply (car f) (cdr f) args))
+      (t               (apply f args)))))
 
 (defmacro vc-call (fun file &rest args)
   "A convenience macro for calling VC backend functions.
@@ -628,8 +633,15 @@ this function."
               (throw 'found trial))))
        templates))))
 
-(define-obsolete-function-alias
-  'vc-toggle-read-only 'toggle-read-only "24.1")
+
+;; toggle-read-only is obsolete since 24.3, but since vc-t-r-o was made
+;; obsolete earlier, it is ok for the latter to be an alias to the former,
+;; since the latter will be removed first.  We can't just make it
+;; an alias for read-only-mode, since that is not 100% the same.
+(defalias 'vc-toggle-read-only 'toggle-read-only)
+(make-obsolete 'vc-toggle-read-only
+               "use `read-only-mode' instead (or `toggle-read-only' in older versions of Emacs)."
+               "24.1")
 
 (defun vc-default-make-version-backups-p (_backend _file)
   "Return non-nil if unmodified versions should be backed up locally.