Mercurial > emacs
comparison lisp/vc-hooks.el @ 54561:225341adbb0d
(vc-arg-list): New function, which handles both compiled and
uncompiled code.
(vc-default-workfile-unchanged-p): Use it.
author | André Spiegel <spiegel@gnu.org> |
---|---|
date | Fri, 26 Mar 2004 06:06:39 +0000 |
parents | a7faa61c45b5 |
children | 51811f399af0 c0e839b60d0b |
comparison
equal
deleted
inserted
replaced
54560:6ad0a43df342 | 54561:225341adbb0d |
---|---|
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.162 2004/03/21 15:44:39 spiegel Exp $ | 9 ;; $Id: vc-hooks.el,v 1.163 2004/03/23 20:59:19 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 |
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 | 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 | |
270 | 279 |
271 (defsubst vc-parse-buffer (pattern i) | 280 (defsubst vc-parse-buffer (pattern i) |
272 "Find PATTERN in the current buffer and return its Ith submatch." | 281 "Find PATTERN in the current buffer and return its Ith submatch." |
273 (goto-char (point-min)) | 282 (goto-char (point-min)) |
274 (if (re-search-forward pattern nil t) | 283 (if (re-search-forward pattern nil t) |
461 unchanged)))) | 470 unchanged)))) |
462 | 471 |
463 (defun vc-default-workfile-unchanged-p (backend file) | 472 (defun vc-default-workfile-unchanged-p (backend file) |
464 "Check if FILE is unchanged by diffing against the master version. | 473 "Check if FILE is unchanged by diffing against the master version. |
465 Return non-nil if FILE is unchanged." | 474 Return non-nil if FILE is unchanged." |
466 (let ((diff-args-length | 475 (zerop (if (> (length (vc-arg-list backend 'diff)) 4) |
467 (length (cadr (symbol-function | 476 ;; If the implementation supports it, let the output |
468 (vc-find-backend-function backend 'diff)))))) | 477 ;; go to *vc*, not *vc-diff*, since this is an internal call. |
469 (zerop (if (> diff-args-length 4) | 478 (vc-call diff file nil nil "*vc*") |
470 ;; If the implementation supports it, let the output | 479 ;; for backward compatibility |
471 ;; go to *vc*, not *vc-diff*, since this is an internal call. | 480 (vc-call diff file)))) |
472 (vc-call diff file nil nil "*vc*") | |
473 ;; for backward compatibility | |
474 (vc-call diff file))))) | |
475 | 481 |
476 (defun vc-workfile-version (file) | 482 (defun vc-workfile-version (file) |
477 "Return the version level of the current workfile FILE. | 483 "Return the version level of the current workfile FILE. |
478 If FILE is not registered, this function always returns nil." | 484 If FILE is not registered, this function always returns nil." |
479 (or (vc-file-getprop file 'vc-workfile-version) | 485 (or (vc-file-getprop file 'vc-workfile-version) |