comparison lisp/vc-hooks.el @ 54783:507f2c946725

(vc-arg-list): Function removed. (vc-default-workfile-unchanged-p): Use condition-case to check for backward compatibility.
author André Spiegel <spiegel@gnu.org>
date Sun, 11 Apr 2004 15:03:21 +0000
parents 51811f399af0
children 08fcaad03634 eb7e8d483840
comparison
equal deleted inserted replaced
54782:6accc4c8d7cb 54783:507f2c946725
4 ;; Free Software Foundation, Inc. 4 ;; Free Software Foundation, Inc.
5 5
6 ;; Author: FSF (see vc.el for full credits) 6 ;; Author: FSF (see vc.el for full credits)
7 ;; Maintainer: Andre Spiegel <spiegel@gnu.org> 7 ;; Maintainer: Andre Spiegel <spiegel@gnu.org>
8 8
9 ;; $Id: vc-hooks.el,v 1.164 2004/03/26 06:06:39 spiegel Exp $ 9 ;; $Id: vc-hooks.el,v 1.165 2004/03/28 17:38:03 monnier Exp $
10 10
11 ;; This file is part of GNU Emacs. 11 ;; This file is part of GNU Emacs.
12 12
13 ;; GNU Emacs is free software; you can redistribute it and/or modify 13 ;; GNU Emacs is free software; you can redistribute it and/or modify
14 ;; it under the terms of the GNU General Public License as published by 14 ;; it under the terms of the GNU General Public License as published by
264 (t (apply f args))))) 264 (t (apply f args)))))
265 265
266 (defmacro vc-call (fun file &rest args) 266 (defmacro vc-call (fun file &rest args)
267 ;; BEWARE!! `file' is evaluated twice!! 267 ;; BEWARE!! `file' is evaluated twice!!
268 `(vc-call-backend (vc-backend ,file) ',fun ,file ,@args)) 268 `(vc-call-backend (vc-backend ,file) ',fun ,file ,@args))
269
270 (defun vc-arg-list (backend fun)
271 "Return the argument list of BACKEND function FUN."
272 (let ((f (symbol-function (vc-find-backend-function backend fun))))
273 (if (listp f)
274 ;; loaded from .el file
275 (cadr f)
276 ;; loaded from .elc file
277 (aref f 0))))
278
279 269
280 (defsubst vc-parse-buffer (pattern i) 270 (defsubst vc-parse-buffer (pattern i)
281 "Find PATTERN in the current buffer and return its Ith submatch." 271 "Find PATTERN in the current buffer and return its Ith submatch."
282 (goto-char (point-min)) 272 (goto-char (point-min))
283 (if (re-search-forward pattern nil t) 273 (if (re-search-forward pattern nil t)
470 unchanged)))) 460 unchanged))))
471 461
472 (defun vc-default-workfile-unchanged-p (backend file) 462 (defun vc-default-workfile-unchanged-p (backend file)
473 "Check if FILE is unchanged by diffing against the master version. 463 "Check if FILE is unchanged by diffing against the master version.
474 Return non-nil if FILE is unchanged." 464 Return non-nil if FILE is unchanged."
475 (zerop (if (> (length (vc-arg-list backend 'diff)) 4) 465 (zerop (condition-case err
476 ;; If the implementation supports it, let the output 466 ;; If the implementation supports it, let the output
477 ;; go to *vc*, not *vc-diff*, since this is an internal call. 467 ;; go to *vc*, not *vc-diff*, since this is an internal call.
478 (vc-call diff file nil nil "*vc*") 468 (vc-call diff file nil nil "*vc*")
479 ;; for backward compatibility 469 (wrong-number-of-arguments
480 (vc-call diff file)))) 470 ;; If this error came from the above call to vc-BACKEND-diff,
471 ;; try again without the optional buffer argument (for
472 ;; backward compatibility). Otherwise, resignal.
473 (if (or (not (eq (cadr err)
474 (indirect-function
475 (vc-find-backend-function (vc-backend file)
476 'diff))))
477 (not (eq (caddr err) 5)))
478 (signal wrong-number-of-arguments err)
479 (vc-call diff file))))))
481 480
482 (defun vc-workfile-version (file) 481 (defun vc-workfile-version (file)
483 "Return the version level of the current workfile FILE. 482 "Return the version level of the current workfile FILE.
484 If FILE is not registered, this function always returns nil." 483 If FILE is not registered, this function always returns nil."
485 (or (vc-file-getprop file 'vc-workfile-version) 484 (or (vc-file-getprop file 'vc-workfile-version)