Mercurial > emacs
comparison lisp/vc-hooks.el @ 31564:00efca34e7d0
Doc fixes.
author | Dave Love <fx@gnu.org> |
---|---|
date | Tue, 12 Sep 2000 13:00:30 +0000 |
parents | c1eb46906717 |
children | 25632a490236 |
comparison
equal
deleted
inserted
replaced
31563:96b9757bfd45 | 31564:00efca34e7d0 |
---|---|
3 ;; Copyright (C) 1992,93,94,95,96,98,99,2000 Free Software Foundation, Inc. | 3 ;; Copyright (C) 1992,93,94,95,96,98,99,2000 Free Software Foundation, Inc. |
4 | 4 |
5 ;; Author: FSF (see vc.el for full credits) | 5 ;; Author: FSF (see vc.el for full credits) |
6 ;; Maintainer: Andre Spiegel <spiegel@gnu.org> | 6 ;; Maintainer: Andre Spiegel <spiegel@gnu.org> |
7 | 7 |
8 ;; $Id: vc-hooks.el,v 1.1 2000/09/06 09:19:14 gerd Exp gerd $ | 8 ;; $Id: vc-hooks.el,v 1.118 2000/09/06 10:41:10 gerd Exp $ |
9 | 9 |
10 ;; This file is part of GNU Emacs. | 10 ;; This file is part of GNU Emacs. |
11 | 11 |
12 ;; GNU Emacs is free software; you can redistribute it and/or modify | 12 ;; GNU Emacs is free software; you can redistribute it and/or modify |
13 ;; it under the terms of the GNU General Public License as published by | 13 ;; it under the terms of the GNU General Public License as published by |
282 (defun vc-backend-subdirectory-name (file) | 282 (defun vc-backend-subdirectory-name (file) |
283 "Return where the master and lock FILEs for the current directory are kept." | 283 "Return where the master and lock FILEs for the current directory are kept." |
284 (symbol-name (vc-backend file))) | 284 (symbol-name (vc-backend file))) |
285 | 285 |
286 (defun vc-name (file) | 286 (defun vc-name (file) |
287 "Return the master name of FILE. If the file is not registered, or | 287 "Return the master name of FILE. |
288 the master name is not known, return nil." | 288 If the file is not registered, or the master name is not known, return nil." |
289 ;; TODO: This should ultimately become obsolete, at least up here | 289 ;; TODO: This should ultimately become obsolete, at least up here |
290 ;; in vc-hooks. | 290 ;; in vc-hooks. |
291 (or (vc-file-getprop file 'vc-name) | 291 (or (vc-file-getprop file 'vc-name) |
292 (if (vc-backend file) | 292 (if (vc-backend file) |
293 (vc-file-getprop file 'vc-name)))) | 293 (vc-file-getprop file 'vc-name)))) |
294 | 294 |
321 (number-to-string (or uid (user-uid))))) | 321 (number-to-string (or uid (user-uid))))) |
322 | 322 |
323 (defun vc-state (file) | 323 (defun vc-state (file) |
324 "Return the version control state of FILE. | 324 "Return the version control state of FILE. |
325 | 325 |
326 The value returned is one of: | 326 The value returned is one of: |
327 | 327 |
328 'up-to-date The working file is unmodified with respect to the | 328 'up-to-date The working file is unmodified with respect to the |
329 latest version on the current branch, and not locked. | 329 latest version on the current branch, and not locked. |
330 | 330 |
331 'edited The working file has been edited by the user. If | 331 'edited The working file has been edited by the user. If |
357 (defsubst vc-up-to-date-p (file) | 357 (defsubst vc-up-to-date-p (file) |
358 "Convenience function that checks whether `vc-state' of FILE is `up-to-date'." | 358 "Convenience function that checks whether `vc-state' of FILE is `up-to-date'." |
359 (eq (vc-state file) 'up-to-date)) | 359 (eq (vc-state file) 'up-to-date)) |
360 | 360 |
361 (defun vc-default-state-heuristic (backend file) | 361 (defun vc-default-state-heuristic (backend file) |
362 "Default implementation of vc-state-heuristic. It simply calls the | 362 "Default implementation of vc-state-heuristic. |
363 real state computation function `vc-BACKEND-state' and does not employ | 363 It simply calls the real state computation function `vc-BACKEND-state' |
364 any heuristic at all." | 364 and does not employ any heuristic at all." |
365 (vc-call-backend backend 'state file)) | 365 (vc-call-backend backend 'state file)) |
366 | 366 |
367 (defun vc-workfile-version (file) | 367 (defun vc-workfile-version (file) |
368 "Return version level of the current workfile FILE." | 368 "Return version level of the current workfile FILE." |
369 (or (vc-file-getprop file 'vc-workfile-version) | 369 (or (vc-file-getprop file 'vc-workfile-version) |
418 return non-nil if it finds a master; that value is then returned by | 418 return non-nil if it finds a master; that value is then returned by |
419 this function." | 419 this function." |
420 (let ((dirname (or (file-name-directory file) "")) | 420 (let ((dirname (or (file-name-directory file) "")) |
421 (basename (file-name-nondirectory file))) | 421 (basename (file-name-nondirectory file))) |
422 (catch 'found | 422 (catch 'found |
423 (mapcar | 423 (mapcar |
424 (lambda (s) | 424 (lambda (s) |
425 (let ((trial (vc-possible-master s dirname basename))) | 425 (let ((trial (vc-possible-master s dirname basename))) |
426 (if (and trial (file-exists-p trial) | 426 (if (and trial (file-exists-p trial) |
427 ;; Make sure the file we found with name | 427 ;; Make sure the file we found with name |
428 ;; TRIAL is not the source file itself. | 428 ;; TRIAL is not the source file itself. |
453 (toggle-read-only))) | 453 (toggle-read-only))) |
454 (define-key global-map "\C-x\C-q" 'vc-toggle-read-only) | 454 (define-key global-map "\C-x\C-q" 'vc-toggle-read-only) |
455 | 455 |
456 (defun vc-after-save () | 456 (defun vc-after-save () |
457 "Function to be called by `basic-save-buffer' (in files.el)." | 457 "Function to be called by `basic-save-buffer' (in files.el)." |
458 ;; If the file in the current buffer is under version control, | 458 ;; If the file in the current buffer is under version control, |
459 ;; up-to-date, and locking is not used for the file, set | 459 ;; up-to-date, and locking is not used for the file, set |
460 ;; the state to 'edited and redisplay the mode line. | 460 ;; the state to 'edited and redisplay the mode line. |
461 (let ((file (buffer-file-name))) | 461 (let ((file (buffer-file-name))) |
462 (and (vc-backend file) | 462 (and (vc-backend file) |
463 (or (and (equal (vc-file-getprop file 'vc-checkout-time) | 463 (or (and (equal (vc-file-getprop file 'vc-checkout-time) |
567 ;; If we already visited this file by following | 567 ;; If we already visited this file by following |
568 ;; the link, don't ask again if we try to visit | 568 ;; the link, don't ask again if we try to visit |
569 ;; it again. GUD does that, and repeated questions | 569 ;; it again. GUD does that, and repeated questions |
570 ;; are painful. | 570 ;; are painful. |
571 (get-file-buffer | 571 (get-file-buffer |
572 (abbreviate-file-name | 572 (abbreviate-file-name |
573 (file-chase-links buffer-file-name)))) | 573 (file-chase-links buffer-file-name)))) |
574 | 574 |
575 (vc-follow-link) | 575 (vc-follow-link) |
576 (message "Followed link to %s" buffer-file-name) | 576 (message "Followed link to %s" buffer-file-name) |
577 (vc-find-file-hook)) | 577 (vc-find-file-hook)) |
594 Used in `find-file-not-found-hooks'." | 594 Used in `find-file-not-found-hooks'." |
595 ;; When a file does not exist, ignore cached info about it | 595 ;; When a file does not exist, ignore cached info about it |
596 ;; from a previous visit. | 596 ;; from a previous visit. |
597 (vc-file-clearprops buffer-file-name) | 597 (vc-file-clearprops buffer-file-name) |
598 (if (and (vc-backend buffer-file-name) | 598 (if (and (vc-backend buffer-file-name) |
599 (yes-or-no-p | 599 (yes-or-no-p |
600 (format "File %s was lost; check out from version control? " | 600 (format "File %s was lost; check out from version control? " |
601 (file-name-nondirectory buffer-file-name)))) | 601 (file-name-nondirectory buffer-file-name)))) |
602 (save-excursion | 602 (save-excursion |
603 (require 'vc) | 603 (require 'vc) |
604 (setq default-directory (file-name-directory buffer-file-name)) | 604 (setq default-directory (file-name-directory buffer-file-name)) |