annotate lisp/vc-hooks.el @ 31382:cde9770b21e0

Minor doc fixes. (vc-default-mode-line-string): Show state `needs-patch' as a `-' too. (vc-after-save): Call vc-dired-resynch-file. (vc-file-not-found-hook): Ask the user whether to check out a non-existing file. (vc-find-backend-function): If function doesn't exist, return nil instead of error. (vc-call-backend): Doc fix. (vc-prefix-map): Move the autoload from vc.el. (vc-simple-command): Removed. (vc-handled-backends): Docstring change. (vc-ignore-vc-files): Mark obsolete. (vc-registered): Check vc-ignore-vc-files. (vc-find-file-hook, vc-file-not-found-hook): Don't check vc-ignore-vc-files. (vc-parse-buffer): Lobotomize the monster. (vc-simple-command): Docstring fix. (vc-registered): Align the way the file-handler is called with the way the function itself works. (vc-file-owner): Remove. (vc-header-alist): Move the dummy def from vc.el. (vc-backend-hook-functions): Remove. (vc-find-backend-function): Don't try to load vc-X-hooks anymore. (vc-backend): Reintroduce the test for `file = nil' now that I know why it was there (and added a comment to better remember). Update Copyright. (vc-backend): Don't accept a nil argument any more. (vc-up-to-date-p): Turn into a defsubst. (vc-possible-master): New function. (vc-check-master-templates): Use `vc-possible-master' and allow funs in vc-X-master-templates to return a non-existent file. (vc-loadup): Remove. (vc-find-backend-function): Use `require'. Also, handle the case where vc-BACKEND-hooks.el doesn't exist. (vc-call-backend): Cleanup. (vc-find-backend-function): Return a cons cell if using the default function. (vc-call-backend): If calling the default function, pass it the backend as first argument. Update the docstring accordingly. (vc-default-state-heuristic, vc-default-mode-line-string): Update for the new backend argument. (vc-make-backend-sym): Renamed from vc-make-backend-function. (vc-find-backend-function): Use the new name. (vc-default-registered): New function. (vc-backend-functions): Remove. (vc-loadup): Don't setup 'vc-functions. (vc-find-backend-function): New function. (vc-call-backend): Use above fun and populate 'vc-functions lazily. (vc-backend-defines): Remove. (vc-backend-hook-functions, vc-backend-functions) (vc-make-backend-function, vc-call): Pass names without leading `vc-' to vc-call-backend so we can blindly prefix them with vc-BACKEND. (vc-loadup): Don't load vc-X-hooks if vc-X is requested. (vc-call-backend): Always try to load vc-X-hooks. (vc-registered): Remove vc- in call to vc-call-backend. (vc-default-back-end, vc-buffer-backend): Remove. (vc-kill-buffer-hook): Remove `vc-buffer-backend' handling. (vc-loadup): Load files quietly. (vc-call-backend): Oops, brain fart. (vc-locking-user): If locked by the calling user, return that name. Redocumented. (vc-user-login-name): Simplify the code a tiny bit. (vc-state): Don't use 'reserved any more. Just use the same convention as the one used for vc-<backend>-state where the locking user (as a string) is returned. (vc-locking-user): Update, based on the above convention. The 'vc-locking-user property has disappeared. (vc-mode-line, vc-default-mode-line-string): Adapt to new `vc-state'. (vc-backend-functions): Removed vc-toggle-read-only. (vc-toggle-read-only): Undid prev change. (vc-master-templates): Def the obsolete var. (vc-file-prop-obarray): Use `make-vector'. (vc-backend-functions): Add new hookable functions vc-toggle-read-only, vc-record-rename and vc-merge-news. (vc-loadup): If neither backend nor default functions exist, use the backend function rather than nil. (vc-call-backend): If the function if not bound yet, try to load the non-hook file to see if it provides it. (vc-call): New macro plus use it wherever possible. (vc-backend-subdirectory-name): Use neither `vc-default-back-end' nor `vc-find-binary' since it's only called from vc-mistrust-permission which is only used once the backend is known. (vc-checkout-model): Fix parenthesis. (vc-recompute-state, vc-prefix-map): Move to vc.el. (vc-backend-functions): Renamed `vc-steal' to `vc-steal-lock'. (vc-call-backend): Changed error message. (vc-state): Added description of state `unlocked-changes'. (vc-backend-hook-functions, vc-backend-functions): Updated function lists. (vc-call-backend): Fixed typo. (vc-backend-hook-functions): Renamed vc-uses-locking to vc-checkout-model. (vc-checkout-required): Renamed to vc-checkout-model. Re-implemented and re-commented. (vc-after-save): Use vc-checkout-model. (vc-backend-functions): Added `vc-diff' to the list of functions possibly implemented in a vc-BACKEND library. (vc-checkout-required): Bug fixed that caused an error to be signaled during `vc-after-save'. (vc-backend-hook-functions): `vc-checkout-required' updated to `vc-uses-locking'. (vc-checkout-required): Call to backend function `vc-checkout-required' updated to `vc-uses-locking' instead. (vc-parse-buffer): Bug found and fixed. (vc-backend-functions): `vc-annotate-command', `vc-annotate-difference' added to supported backend functions. vc-state-heuristic added to vc-backend-hook-functions. Implemented new state model. (vc-state, vc-state-heuristic, vc-default-state-heuristic): New functions. (vc-locking-user): Simplified. Now only needed if the file is locked by somebody else. (vc-lock-from-permissions): Removed. Functionality is in vc-sccs-hooks.el and vc-rcs-hooks.el now. (vc-mode-line-string): New name for former vc-status. Adapted. (vc-mode-line): Adapted to use the above. Removed optional parameter. (vc-master-templates): Is really obsolete. Commented out the definition for now. What is the right procedure to get rid of it? (vc-registered, vc-backend, vc-buffer-backend, vc-name): Largely rewritten. (vc-default-registered): Removed. (vc-check-master-templates): New function; does mostly what the above did before. (vc-locking-user): Don't rely on the backend to set the property. (vc-latest-version, vc-your-latest-version): Removed. (vc-backend-hook-functions): Removed them from this list, too. (vc-fetch-properties): Removed. (vc-workfile-version): Doc fix. (vc-consult-rcs-headers): Moved into vc-rcs-hooks.el, under the name vc-rcs-consult-headers. (vc-master-locks, vc-master-locking-user): Moved into both vc-rcs-hooks.el and vc-sccs-hooks.el. These properties and access functions are implementation details of those two backends. (vc-parse-locks, vc-fetch-master-properties): Split into back-end specific parts and removed. Callers not updated yet; because I guess these callers will disappear into back-end specific files anyway. (vc-checkout-model): Renamed to vc-uses-locking. Store yes/no in the property, and return t/nil. Updated all callers. (vc-checkout-model): Punt to backends. (vc-default-locking-user): New function. (vc-locking-user, vc-workfile-version): Punt to backends. (vc-rcsdiff-knows-brief, vc-rcs-lock-from-diff) (vc-master-workfile-version): Moved from vc-hooks. (vc-lock-file): Moved to vc-sccs-hooks and renamed. (vc-handle-cvs, vc-cvs-parse-status, vc-cvs-status): Moved to vc-cvs-hooks. Add doc strings in various places. Simplify the minor mode setup. (vc-handled-backends): New user variable. (vc-parse-buffer, vc-insert-file, vc-default-registered): Minor simplification. (vc-backend-hook-functions, vc-backend-functions): New variable. (vc-make-backend-function, vc-loadup, vc-call-backend) (vc-backend-defines): New functions. Various doc fixes. (vc-default-back-end, vc-follow-symlinks): Custom fix. (vc-match-substring): Function removed. Callers changed to use match-string. (vc-lock-file, vc-consult-rcs-headers, vc-kill-buffer-hook): Simplify. vc-registered has been renamed vc-default-registered. Some functions have been moved to the backend specific files. they all support the vc-BACKEND-registered functions. This is 1.113 from the emacs sources
author Gerd Moellmann <gerd@gnu.org>
date Mon, 04 Sep 2000 19:47:25 +0000
parents debabcd474f5
children f2ab9420390f
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
2232
4f9d60f7de9d Add standard library headers.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 2227
diff changeset
1 ;;; vc-hooks.el --- resident support for version-control
904
4a1ac370d57a Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
2
31382
cde9770b21e0 Minor doc fixes.
Gerd Moellmann <gerd@gnu.org>
parents: 27262
diff changeset
3 ;; Copyright (C) 1992,93,94,95,96,98,99,2000 Free Software Foundation, Inc.
904
4a1ac370d57a Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
4
31382
cde9770b21e0 Minor doc fixes.
Gerd Moellmann <gerd@gnu.org>
parents: 27262
diff changeset
5 ;; Author: FSF (see vc.el for full credits)
cde9770b21e0 Minor doc fixes.
Gerd Moellmann <gerd@gnu.org>
parents: 27262
diff changeset
6 ;; Maintainer: Andre Spiegel <spiegel@gnu.org>
904
4a1ac370d57a Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
7
31382
cde9770b21e0 Minor doc fixes.
Gerd Moellmann <gerd@gnu.org>
parents: 27262
diff changeset
8 ;; $Id: vc-hooks.el,v 1.53 2000/08/13 11:36:46 spiegel Exp $
20989
c11150812ca0 Added version id.
André Spiegel <spiegel@gnu.org>
parents: 20844
diff changeset
9
904
4a1ac370d57a Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
10 ;; This file is part of GNU Emacs.
4a1ac370d57a Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
11
4a1ac370d57a Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
12 ;; GNU Emacs is free software; you can redistribute it and/or modify
4a1ac370d57a Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
13 ;; it under the terms of the GNU General Public License as published by
4a1ac370d57a Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
14 ;; the Free Software Foundation; either version 2, or (at your option)
4a1ac370d57a Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
15 ;; any later version.
4a1ac370d57a Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
16
4a1ac370d57a Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
17 ;; GNU Emacs is distributed in the hope that it will be useful,
4a1ac370d57a Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
18 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
4a1ac370d57a Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
19 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
4a1ac370d57a Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
20 ;; GNU General Public License for more details.
4a1ac370d57a Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
21
4a1ac370d57a Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
22 ;; You should have received a copy of the GNU General Public License
14169
83f275dcd93a Update FSF's address.
Erik Naggum <erik@naggum.no>
parents: 14142
diff changeset
23 ;; along with GNU Emacs; see the file COPYING. If not, write to the
83f275dcd93a Update FSF's address.
Erik Naggum <erik@naggum.no>
parents: 14142
diff changeset
24 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
83f275dcd93a Update FSF's address.
Erik Naggum <erik@naggum.no>
parents: 14142
diff changeset
25 ;; Boston, MA 02111-1307, USA.
904
4a1ac370d57a Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
26
4a1ac370d57a Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
27 ;;; Commentary:
4a1ac370d57a Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
28
31382
cde9770b21e0 Minor doc fixes.
Gerd Moellmann <gerd@gnu.org>
parents: 27262
diff changeset
29 ;; This is the always-loaded portion of VC. It takes care of
cde9770b21e0 Minor doc fixes.
Gerd Moellmann <gerd@gnu.org>
parents: 27262
diff changeset
30 ;; VC-related activities that are done when you visit a file, so that
cde9770b21e0 Minor doc fixes.
Gerd Moellmann <gerd@gnu.org>
parents: 27262
diff changeset
31 ;; vc.el itself is loaded only when you use a VC command. See the
cde9770b21e0 Minor doc fixes.
Gerd Moellmann <gerd@gnu.org>
parents: 27262
diff changeset
32 ;; commentary of vc.el.
904
4a1ac370d57a Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
33
4a1ac370d57a Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
34 ;;; Code:
4a1ac370d57a Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
35
11604
401afae906eb (vc-default-backend, vc-path, vc-consult-headers):
Karl Heuer <kwzh@gnu.org>
parents: 11598
diff changeset
36 ;; Customization Variables (the rest is in vc.el)
401afae906eb (vc-default-backend, vc-path, vc-consult-headers):
Karl Heuer <kwzh@gnu.org>
parents: 11598
diff changeset
37
31382
cde9770b21e0 Minor doc fixes.
Gerd Moellmann <gerd@gnu.org>
parents: 27262
diff changeset
38 (defvar vc-ignore-vc-files nil "Obsolete -- use `vc-handled-backends'.")
cde9770b21e0 Minor doc fixes.
Gerd Moellmann <gerd@gnu.org>
parents: 27262
diff changeset
39 (defvar vc-master-templates () "Obsolete -- use vc-BACKEND-master-templates.")
cde9770b21e0 Minor doc fixes.
Gerd Moellmann <gerd@gnu.org>
parents: 27262
diff changeset
40 (defvar vc-header-alist () "Obsolete -- use vc-BACKEND-header.")
11604
401afae906eb (vc-default-backend, vc-path, vc-consult-headers):
Karl Heuer <kwzh@gnu.org>
parents: 11598
diff changeset
41
31382
cde9770b21e0 Minor doc fixes.
Gerd Moellmann <gerd@gnu.org>
parents: 27262
diff changeset
42 (defcustom vc-handled-backends '(RCS CVS SCCS)
cde9770b21e0 Minor doc fixes.
Gerd Moellmann <gerd@gnu.org>
parents: 27262
diff changeset
43 "*List of version control backends for which VC will be used.
cde9770b21e0 Minor doc fixes.
Gerd Moellmann <gerd@gnu.org>
parents: 27262
diff changeset
44 Entries in this list will be tried in order to determine whether a
cde9770b21e0 Minor doc fixes.
Gerd Moellmann <gerd@gnu.org>
parents: 27262
diff changeset
45 file is under that sort of version control.
cde9770b21e0 Minor doc fixes.
Gerd Moellmann <gerd@gnu.org>
parents: 27262
diff changeset
46 Removing an entry from the list prevents VC from being activated
cde9770b21e0 Minor doc fixes.
Gerd Moellmann <gerd@gnu.org>
parents: 27262
diff changeset
47 when visiting a file managed by that backend.
cde9770b21e0 Minor doc fixes.
Gerd Moellmann <gerd@gnu.org>
parents: 27262
diff changeset
48 An empty list disables VC altogether."
cde9770b21e0 Minor doc fixes.
Gerd Moellmann <gerd@gnu.org>
parents: 27262
diff changeset
49 :type '(repeat symbol)
cde9770b21e0 Minor doc fixes.
Gerd Moellmann <gerd@gnu.org>
parents: 27262
diff changeset
50 :version "20.5"
20413
7d1e9fc47f9d Customized.
Karl Heuer <kwzh@gnu.org>
parents: 20008
diff changeset
51 :group 'vc)
13378
96ff45331eb4 (vc-utc-string): Use timezone of TIMEVAL for the correction, not the
André Spiegel <spiegel@gnu.org>
parents: 13034
diff changeset
52
20413
7d1e9fc47f9d Customized.
Karl Heuer <kwzh@gnu.org>
parents: 20008
diff changeset
53 (defcustom vc-path
11604
401afae906eb (vc-default-backend, vc-path, vc-consult-headers):
Karl Heuer <kwzh@gnu.org>
parents: 11598
diff changeset
54 (if (file-directory-p "/usr/sccs")
401afae906eb (vc-default-backend, vc-path, vc-consult-headers):
Karl Heuer <kwzh@gnu.org>
parents: 11598
diff changeset
55 '("/usr/sccs")
401afae906eb (vc-default-backend, vc-path, vc-consult-headers):
Karl Heuer <kwzh@gnu.org>
parents: 11598
diff changeset
56 nil)
20413
7d1e9fc47f9d Customized.
Karl Heuer <kwzh@gnu.org>
parents: 20008
diff changeset
57 "*List of extra directories to search for version control commands."
7d1e9fc47f9d Customized.
Karl Heuer <kwzh@gnu.org>
parents: 20008
diff changeset
58 :type '(repeat directory)
7d1e9fc47f9d Customized.
Karl Heuer <kwzh@gnu.org>
parents: 20008
diff changeset
59 :group 'vc)
11604
401afae906eb (vc-default-backend, vc-path, vc-consult-headers):
Karl Heuer <kwzh@gnu.org>
parents: 11598
diff changeset
60
20413
7d1e9fc47f9d Customized.
Karl Heuer <kwzh@gnu.org>
parents: 20008
diff changeset
61 (defcustom vc-make-backup-files nil
5164
04d6b9e7782a (vc-make-backup-files): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents: 4726
diff changeset
62 "*If non-nil, backups of registered files are made as with other files.
20413
7d1e9fc47f9d Customized.
Karl Heuer <kwzh@gnu.org>
parents: 20008
diff changeset
63 If nil (the default), files covered by version control don't get backups."
7d1e9fc47f9d Customized.
Karl Heuer <kwzh@gnu.org>
parents: 20008
diff changeset
64 :type 'boolean
7d1e9fc47f9d Customized.
Karl Heuer <kwzh@gnu.org>
parents: 20008
diff changeset
65 :group 'vc)
904
4a1ac370d57a Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
66
20413
7d1e9fc47f9d Customized.
Karl Heuer <kwzh@gnu.org>
parents: 20008
diff changeset
67 (defcustom vc-follow-symlinks 'ask
31382
cde9770b21e0 Minor doc fixes.
Gerd Moellmann <gerd@gnu.org>
parents: 27262
diff changeset
68 "*What to do if visiting a symbolic link to a file under version control.
cde9770b21e0 Minor doc fixes.
Gerd Moellmann <gerd@gnu.org>
parents: 27262
diff changeset
69 Editing such a file through the link bypasses the version control system,
cde9770b21e0 Minor doc fixes.
Gerd Moellmann <gerd@gnu.org>
parents: 27262
diff changeset
70 which is dangerous and probably not what you want.
cde9770b21e0 Minor doc fixes.
Gerd Moellmann <gerd@gnu.org>
parents: 27262
diff changeset
71
cde9770b21e0 Minor doc fixes.
Gerd Moellmann <gerd@gnu.org>
parents: 27262
diff changeset
72 If this variable is t, VC follows the link and visits the real file,
14142
c9cb9dbb2d40 (vc-follow-symlinks): New variable.
André Spiegel <spiegel@gnu.org>
parents: 14040
diff changeset
73 telling you about it in the echo area. If it is `ask', VC asks for
c9cb9dbb2d40 (vc-follow-symlinks): New variable.
André Spiegel <spiegel@gnu.org>
parents: 14040
diff changeset
74 confirmation whether it should follow the link. If nil, the link is
20413
7d1e9fc47f9d Customized.
Karl Heuer <kwzh@gnu.org>
parents: 20008
diff changeset
75 visited and a warning displayed."
31382
cde9770b21e0 Minor doc fixes.
Gerd Moellmann <gerd@gnu.org>
parents: 27262
diff changeset
76 :type '(choice (const :tag "Ask for confirmation" ask)
cde9770b21e0 Minor doc fixes.
Gerd Moellmann <gerd@gnu.org>
parents: 27262
diff changeset
77 (const :tag "Visit link and warn" nil)
cde9770b21e0 Minor doc fixes.
Gerd Moellmann <gerd@gnu.org>
parents: 27262
diff changeset
78 (const :tag "Follow link" t))
20413
7d1e9fc47f9d Customized.
Karl Heuer <kwzh@gnu.org>
parents: 20008
diff changeset
79 :group 'vc)
14142
c9cb9dbb2d40 (vc-follow-symlinks): New variable.
André Spiegel <spiegel@gnu.org>
parents: 14040
diff changeset
80
20413
7d1e9fc47f9d Customized.
Karl Heuer <kwzh@gnu.org>
parents: 20008
diff changeset
81 (defcustom vc-display-status t
8982
2a81d1c79162 (vc-menu-map): Set up menu items.
Richard M. Stallman <rms@gnu.org>
parents: 7568
diff changeset
82 "*If non-nil, display revision number and lock status in modeline.
20413
7d1e9fc47f9d Customized.
Karl Heuer <kwzh@gnu.org>
parents: 20008
diff changeset
83 Otherwise, not displayed."
7d1e9fc47f9d Customized.
Karl Heuer <kwzh@gnu.org>
parents: 20008
diff changeset
84 :type 'boolean
7d1e9fc47f9d Customized.
Karl Heuer <kwzh@gnu.org>
parents: 20008
diff changeset
85 :group 'vc)
7d1e9fc47f9d Customized.
Karl Heuer <kwzh@gnu.org>
parents: 20008
diff changeset
86
3900
c6f3d2af0df7 (vc-rcs-status): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 3459
diff changeset
87
20413
7d1e9fc47f9d Customized.
Karl Heuer <kwzh@gnu.org>
parents: 20008
diff changeset
88 (defcustom vc-consult-headers t
7d1e9fc47f9d Customized.
Karl Heuer <kwzh@gnu.org>
parents: 20008
diff changeset
89 "*If non-nil, identify work files by searching for version headers."
7d1e9fc47f9d Customized.
Karl Heuer <kwzh@gnu.org>
parents: 20008
diff changeset
90 :type 'boolean
7d1e9fc47f9d Customized.
Karl Heuer <kwzh@gnu.org>
parents: 20008
diff changeset
91 :group 'vc)
11604
401afae906eb (vc-default-backend, vc-path, vc-consult-headers):
Karl Heuer <kwzh@gnu.org>
parents: 11598
diff changeset
92
20413
7d1e9fc47f9d Customized.
Karl Heuer <kwzh@gnu.org>
parents: 20008
diff changeset
93 (defcustom vc-keep-workfiles t
11604
401afae906eb (vc-default-backend, vc-path, vc-consult-headers):
Karl Heuer <kwzh@gnu.org>
parents: 11598
diff changeset
94 "*If non-nil, don't delete working files after registering changes.
401afae906eb (vc-default-backend, vc-path, vc-consult-headers):
Karl Heuer <kwzh@gnu.org>
parents: 11598
diff changeset
95 If the back-end is CVS, workfiles are always kept, regardless of the
20413
7d1e9fc47f9d Customized.
Karl Heuer <kwzh@gnu.org>
parents: 20008
diff changeset
96 value of this flag."
7d1e9fc47f9d Customized.
Karl Heuer <kwzh@gnu.org>
parents: 20008
diff changeset
97 :type 'boolean
7d1e9fc47f9d Customized.
Karl Heuer <kwzh@gnu.org>
parents: 20008
diff changeset
98 :group 'vc)
11604
401afae906eb (vc-default-backend, vc-path, vc-consult-headers):
Karl Heuer <kwzh@gnu.org>
parents: 11598
diff changeset
99
20413
7d1e9fc47f9d Customized.
Karl Heuer <kwzh@gnu.org>
parents: 20008
diff changeset
100 (defcustom vc-mistrust-permissions nil
31382
cde9770b21e0 Minor doc fixes.
Gerd Moellmann <gerd@gnu.org>
parents: 27262
diff changeset
101 "*If non-nil, don't assume permissions/ownership track version-control status.
cde9770b21e0 Minor doc fixes.
Gerd Moellmann <gerd@gnu.org>
parents: 27262
diff changeset
102 If nil, do rely on the permissions.
20413
7d1e9fc47f9d Customized.
Karl Heuer <kwzh@gnu.org>
parents: 20008
diff changeset
103 See also variable `vc-consult-headers'."
7d1e9fc47f9d Customized.
Karl Heuer <kwzh@gnu.org>
parents: 20008
diff changeset
104 :type 'boolean
7d1e9fc47f9d Customized.
Karl Heuer <kwzh@gnu.org>
parents: 20008
diff changeset
105 :group 'vc)
12914
22f47b2375c1 (vc-fetch-master-properties): RCS case: get locking mode.
André Spiegel <spiegel@gnu.org>
parents: 12884
diff changeset
106
22f47b2375c1 (vc-fetch-master-properties): RCS case: get locking mode.
André Spiegel <spiegel@gnu.org>
parents: 12884
diff changeset
107 (defun vc-mistrust-permissions (file)
31382
cde9770b21e0 Minor doc fixes.
Gerd Moellmann <gerd@gnu.org>
parents: 27262
diff changeset
108 "Internal access function to variable `vc-mistrust-permissions' for FILE."
12914
22f47b2375c1 (vc-fetch-master-properties): RCS case: get locking mode.
André Spiegel <spiegel@gnu.org>
parents: 12884
diff changeset
109 (or (eq vc-mistrust-permissions 't)
22f47b2375c1 (vc-fetch-master-properties): RCS case: get locking mode.
André Spiegel <spiegel@gnu.org>
parents: 12884
diff changeset
110 (and vc-mistrust-permissions
31382
cde9770b21e0 Minor doc fixes.
Gerd Moellmann <gerd@gnu.org>
parents: 27262
diff changeset
111 (funcall vc-mistrust-permissions
12914
22f47b2375c1 (vc-fetch-master-properties): RCS case: get locking mode.
André Spiegel <spiegel@gnu.org>
parents: 12884
diff changeset
112 (vc-backend-subdirectory-name file)))))
22f47b2375c1 (vc-fetch-master-properties): RCS case: get locking mode.
André Spiegel <spiegel@gnu.org>
parents: 12884
diff changeset
113
904
4a1ac370d57a Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
114 ;; Tell Emacs about this new kind of minor mode
31382
cde9770b21e0 Minor doc fixes.
Gerd Moellmann <gerd@gnu.org>
parents: 27262
diff changeset
115 (add-to-list 'minor-mode-alist '(vc-mode vc-mode))
904
4a1ac370d57a Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
116
2491
5f3061858f47 vc-mode: name change.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 2232
diff changeset
117 (make-variable-buffer-local 'vc-mode)
2620
d26f75fd9f5e (vc-mode-line): Don't alter key bindings.
Richard M. Stallman <rms@gnu.org>
parents: 2491
diff changeset
118 (put 'vc-mode 'permanent-local t)
904
4a1ac370d57a Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
119
4a1ac370d57a Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
120 ;; We need a notion of per-file properties because the version
11598
540868154dc9 (vc-buffer-backend): New function.
Richard M. Stallman <rms@gnu.org>
parents: 10176
diff changeset
121 ;; control state of a file is expensive to derive --- we compute
31382
cde9770b21e0 Minor doc fixes.
Gerd Moellmann <gerd@gnu.org>
parents: 27262
diff changeset
122 ;; them when the file is initially found, keep them up to date
11598
540868154dc9 (vc-buffer-backend): New function.
Richard M. Stallman <rms@gnu.org>
parents: 10176
diff changeset
123 ;; during any subsequent VC operations, and forget them when
540868154dc9 (vc-buffer-backend): New function.
Richard M. Stallman <rms@gnu.org>
parents: 10176
diff changeset
124 ;; the buffer is killed.
904
4a1ac370d57a Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
125
2213
9ff513b5d296 vc-error-occurred: moved to vc-hooks.el in order for ^X^F of a
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1951
diff changeset
126 (defmacro vc-error-occurred (&rest body)
9ff513b5d296 vc-error-occurred: moved to vc-hooks.el in order for ^X^F of a
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1951
diff changeset
127 (list 'condition-case nil (cons 'progn (append body '(nil))) '(error t)))
9ff513b5d296 vc-error-occurred: moved to vc-hooks.el in order for ^X^F of a
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1951
diff changeset
128
31382
cde9770b21e0 Minor doc fixes.
Gerd Moellmann <gerd@gnu.org>
parents: 27262
diff changeset
129 (defvar vc-file-prop-obarray (make-vector 16 0)
904
4a1ac370d57a Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
130 "Obarray for per-file properties.")
4a1ac370d57a Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
131
4a1ac370d57a Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
132 (defun vc-file-setprop (file property value)
31382
cde9770b21e0 Minor doc fixes.
Gerd Moellmann <gerd@gnu.org>
parents: 27262
diff changeset
133 "Set per-file VC PROPERTY for FILE to VALUE."
904
4a1ac370d57a Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
134 (put (intern file vc-file-prop-obarray) property value))
4a1ac370d57a Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
135
4a1ac370d57a Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
136 (defun vc-file-getprop (file property)
31382
cde9770b21e0 Minor doc fixes.
Gerd Moellmann <gerd@gnu.org>
parents: 27262
diff changeset
137 "get per-file VC PROPERTY for FILE."
904
4a1ac370d57a Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
138 (get (intern file vc-file-prop-obarray) property))
4a1ac370d57a Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
139
11604
401afae906eb (vc-default-backend, vc-path, vc-consult-headers):
Karl Heuer <kwzh@gnu.org>
parents: 11598
diff changeset
140 (defun vc-file-clearprops (file)
31382
cde9770b21e0 Minor doc fixes.
Gerd Moellmann <gerd@gnu.org>
parents: 27262
diff changeset
141 "Clear all VC properties of FILE."
11604
401afae906eb (vc-default-backend, vc-path, vc-consult-headers):
Karl Heuer <kwzh@gnu.org>
parents: 11598
diff changeset
142 (setplist (intern file vc-file-prop-obarray) nil))
401afae906eb (vc-default-backend, vc-path, vc-consult-headers):
Karl Heuer <kwzh@gnu.org>
parents: 11598
diff changeset
143
31382
cde9770b21e0 Minor doc fixes.
Gerd Moellmann <gerd@gnu.org>
parents: 27262
diff changeset
144
cde9770b21e0 Minor doc fixes.
Gerd Moellmann <gerd@gnu.org>
parents: 27262
diff changeset
145 ;; We keep properties on each symbol naming a backend as follows:
cde9770b21e0 Minor doc fixes.
Gerd Moellmann <gerd@gnu.org>
parents: 27262
diff changeset
146 ;; * `vc-functions': an alist mapping vc-FUNCTION to vc-BACKEND-FUNCTION.
11604
401afae906eb (vc-default-backend, vc-path, vc-consult-headers):
Karl Heuer <kwzh@gnu.org>
parents: 11598
diff changeset
147
31382
cde9770b21e0 Minor doc fixes.
Gerd Moellmann <gerd@gnu.org>
parents: 27262
diff changeset
148 (defun vc-make-backend-sym (backend sym)
cde9770b21e0 Minor doc fixes.
Gerd Moellmann <gerd@gnu.org>
parents: 27262
diff changeset
149 "Return BACKEND-specific version of VC symbol SYM."
cde9770b21e0 Minor doc fixes.
Gerd Moellmann <gerd@gnu.org>
parents: 27262
diff changeset
150 (intern (concat "vc-" (downcase (symbol-name backend))
cde9770b21e0 Minor doc fixes.
Gerd Moellmann <gerd@gnu.org>
parents: 27262
diff changeset
151 "-" (symbol-name sym))))
11604
401afae906eb (vc-default-backend, vc-path, vc-consult-headers):
Karl Heuer <kwzh@gnu.org>
parents: 11598
diff changeset
152
31382
cde9770b21e0 Minor doc fixes.
Gerd Moellmann <gerd@gnu.org>
parents: 27262
diff changeset
153 (defun vc-find-backend-function (backend fun)
cde9770b21e0 Minor doc fixes.
Gerd Moellmann <gerd@gnu.org>
parents: 27262
diff changeset
154 "Return BACKEND-specific implementation of FUN.
cde9770b21e0 Minor doc fixes.
Gerd Moellmann <gerd@gnu.org>
parents: 27262
diff changeset
155 If there is no such implementation, return the default implementation;
cde9770b21e0 Minor doc fixes.
Gerd Moellmann <gerd@gnu.org>
parents: 27262
diff changeset
156 if that doesn't exist either, return nil."
cde9770b21e0 Minor doc fixes.
Gerd Moellmann <gerd@gnu.org>
parents: 27262
diff changeset
157 (let ((f (vc-make-backend-sym backend fun)))
cde9770b21e0 Minor doc fixes.
Gerd Moellmann <gerd@gnu.org>
parents: 27262
diff changeset
158 (if (fboundp f) f
cde9770b21e0 Minor doc fixes.
Gerd Moellmann <gerd@gnu.org>
parents: 27262
diff changeset
159 ;; Load vc-BACKEND.el if needed.
cde9770b21e0 Minor doc fixes.
Gerd Moellmann <gerd@gnu.org>
parents: 27262
diff changeset
160 (require (intern (concat "vc-" (downcase (symbol-name backend)))))
cde9770b21e0 Minor doc fixes.
Gerd Moellmann <gerd@gnu.org>
parents: 27262
diff changeset
161 (if (fboundp f) f
cde9770b21e0 Minor doc fixes.
Gerd Moellmann <gerd@gnu.org>
parents: 27262
diff changeset
162 (let ((def (vc-make-backend-sym 'default fun)))
cde9770b21e0 Minor doc fixes.
Gerd Moellmann <gerd@gnu.org>
parents: 27262
diff changeset
163 (if (fboundp def) (cons def backend) nil))))))
cde9770b21e0 Minor doc fixes.
Gerd Moellmann <gerd@gnu.org>
parents: 27262
diff changeset
164
cde9770b21e0 Minor doc fixes.
Gerd Moellmann <gerd@gnu.org>
parents: 27262
diff changeset
165 (defun vc-call-backend (backend function-name &rest args)
cde9770b21e0 Minor doc fixes.
Gerd Moellmann <gerd@gnu.org>
parents: 27262
diff changeset
166 "Call for BACKEND the implementation of FUNCTION-NAME with the given ARGS.
cde9770b21e0 Minor doc fixes.
Gerd Moellmann <gerd@gnu.org>
parents: 27262
diff changeset
167 Calls
11604
401afae906eb (vc-default-backend, vc-path, vc-consult-headers):
Karl Heuer <kwzh@gnu.org>
parents: 11598
diff changeset
168
31382
cde9770b21e0 Minor doc fixes.
Gerd Moellmann <gerd@gnu.org>
parents: 27262
diff changeset
169 (apply 'vc-BACKEND-FUN ARGS)
cde9770b21e0 Minor doc fixes.
Gerd Moellmann <gerd@gnu.org>
parents: 27262
diff changeset
170
cde9770b21e0 Minor doc fixes.
Gerd Moellmann <gerd@gnu.org>
parents: 27262
diff changeset
171 if vc-BACKEND-FUN exists (after trying to find it in vc-BACKEND.el)
cde9770b21e0 Minor doc fixes.
Gerd Moellmann <gerd@gnu.org>
parents: 27262
diff changeset
172 and else calls
cde9770b21e0 Minor doc fixes.
Gerd Moellmann <gerd@gnu.org>
parents: 27262
diff changeset
173
cde9770b21e0 Minor doc fixes.
Gerd Moellmann <gerd@gnu.org>
parents: 27262
diff changeset
174 (apply 'vc-default-FUN BACKEND ARGS)
cde9770b21e0 Minor doc fixes.
Gerd Moellmann <gerd@gnu.org>
parents: 27262
diff changeset
175
cde9770b21e0 Minor doc fixes.
Gerd Moellmann <gerd@gnu.org>
parents: 27262
diff changeset
176 It is usually called via the `vc-call' macro."
cde9770b21e0 Minor doc fixes.
Gerd Moellmann <gerd@gnu.org>
parents: 27262
diff changeset
177 (let ((f (cdr (assoc function-name (get backend 'vc-functions)))))
cde9770b21e0 Minor doc fixes.
Gerd Moellmann <gerd@gnu.org>
parents: 27262
diff changeset
178 (unless f
cde9770b21e0 Minor doc fixes.
Gerd Moellmann <gerd@gnu.org>
parents: 27262
diff changeset
179 (setq f (vc-find-backend-function backend function-name))
cde9770b21e0 Minor doc fixes.
Gerd Moellmann <gerd@gnu.org>
parents: 27262
diff changeset
180 (put backend 'vc-functions (cons (cons function-name f)
cde9770b21e0 Minor doc fixes.
Gerd Moellmann <gerd@gnu.org>
parents: 27262
diff changeset
181 (get backend 'vc-functions))))
cde9770b21e0 Minor doc fixes.
Gerd Moellmann <gerd@gnu.org>
parents: 27262
diff changeset
182 (if (consp f)
cde9770b21e0 Minor doc fixes.
Gerd Moellmann <gerd@gnu.org>
parents: 27262
diff changeset
183 (apply (car f) (cdr f) args)
cde9770b21e0 Minor doc fixes.
Gerd Moellmann <gerd@gnu.org>
parents: 27262
diff changeset
184 (apply f args))))
cde9770b21e0 Minor doc fixes.
Gerd Moellmann <gerd@gnu.org>
parents: 27262
diff changeset
185
cde9770b21e0 Minor doc fixes.
Gerd Moellmann <gerd@gnu.org>
parents: 27262
diff changeset
186 (defmacro vc-call (fun file &rest args)
cde9770b21e0 Minor doc fixes.
Gerd Moellmann <gerd@gnu.org>
parents: 27262
diff changeset
187 ;; BEWARE!! `file' is evaluated twice!!
cde9770b21e0 Minor doc fixes.
Gerd Moellmann <gerd@gnu.org>
parents: 27262
diff changeset
188 `(vc-call-backend (vc-backend ,file) ',fun ,file ,@args))
cde9770b21e0 Minor doc fixes.
Gerd Moellmann <gerd@gnu.org>
parents: 27262
diff changeset
189
cde9770b21e0 Minor doc fixes.
Gerd Moellmann <gerd@gnu.org>
parents: 27262
diff changeset
190
cde9770b21e0 Minor doc fixes.
Gerd Moellmann <gerd@gnu.org>
parents: 27262
diff changeset
191 (defsubst vc-parse-buffer (pattern i)
cde9770b21e0 Minor doc fixes.
Gerd Moellmann <gerd@gnu.org>
parents: 27262
diff changeset
192 "Find PATTERN in the current buffer and return its Ith submatch."
cde9770b21e0 Minor doc fixes.
Gerd Moellmann <gerd@gnu.org>
parents: 27262
diff changeset
193 (goto-char (point-min))
cde9770b21e0 Minor doc fixes.
Gerd Moellmann <gerd@gnu.org>
parents: 27262
diff changeset
194 (if (re-search-forward pattern nil t)
cde9770b21e0 Minor doc fixes.
Gerd Moellmann <gerd@gnu.org>
parents: 27262
diff changeset
195 (match-string i)))
11598
540868154dc9 (vc-buffer-backend): New function.
Richard M. Stallman <rms@gnu.org>
parents: 10176
diff changeset
196
12251
f2519a110e5f The RCS status is now found by reading the
Richard M. Stallman <rms@gnu.org>
parents: 12102
diff changeset
197 (defun vc-insert-file (file &optional limit blocksize)
31382
cde9770b21e0 Minor doc fixes.
Gerd Moellmann <gerd@gnu.org>
parents: 27262
diff changeset
198 "Insert the contents of FILE into the current buffer.
cde9770b21e0 Minor doc fixes.
Gerd Moellmann <gerd@gnu.org>
parents: 27262
diff changeset
199
cde9770b21e0 Minor doc fixes.
Gerd Moellmann <gerd@gnu.org>
parents: 27262
diff changeset
200 Optional argument LIMIT is a regexp. If present, the file is inserted
cde9770b21e0 Minor doc fixes.
Gerd Moellmann <gerd@gnu.org>
parents: 27262
diff changeset
201 in chunks of size BLOCKSIZE (default 8 kByte), until the first
cde9770b21e0 Minor doc fixes.
Gerd Moellmann <gerd@gnu.org>
parents: 27262
diff changeset
202 occurrence of LIMIT is found. The function returns nil if FILE doesn't
cde9770b21e0 Minor doc fixes.
Gerd Moellmann <gerd@gnu.org>
parents: 27262
diff changeset
203 exist."
12367
f268f652055e (vc-insert-file): Erase the current buffer before inserting the file.
Richard M. Stallman <rms@gnu.org>
parents: 12359
diff changeset
204 (erase-buffer)
12251
f2519a110e5f The RCS status is now found by reading the
Richard M. Stallman <rms@gnu.org>
parents: 12102
diff changeset
205 (cond ((file-exists-p file)
f2519a110e5f The RCS status is now found by reading the
Richard M. Stallman <rms@gnu.org>
parents: 12102
diff changeset
206 (cond (limit
f2519a110e5f The RCS status is now found by reading the
Richard M. Stallman <rms@gnu.org>
parents: 12102
diff changeset
207 (if (not blocksize) (setq blocksize 8192))
f2519a110e5f The RCS status is now found by reading the
Richard M. Stallman <rms@gnu.org>
parents: 12102
diff changeset
208 (let (found s)
f2519a110e5f The RCS status is now found by reading the
Richard M. Stallman <rms@gnu.org>
parents: 12102
diff changeset
209 (while (not found)
f2519a110e5f The RCS status is now found by reading the
Richard M. Stallman <rms@gnu.org>
parents: 12102
diff changeset
210 (setq s (buffer-size))
f2519a110e5f The RCS status is now found by reading the
Richard M. Stallman <rms@gnu.org>
parents: 12102
diff changeset
211 (goto-char (1+ s))
31382
cde9770b21e0 Minor doc fixes.
Gerd Moellmann <gerd@gnu.org>
parents: 27262
diff changeset
212 (setq found
cde9770b21e0 Minor doc fixes.
Gerd Moellmann <gerd@gnu.org>
parents: 27262
diff changeset
213 (or (zerop (cadr (insert-file-contents
cde9770b21e0 Minor doc fixes.
Gerd Moellmann <gerd@gnu.org>
parents: 27262
diff changeset
214 file nil s (+ s blocksize))))
12251
f2519a110e5f The RCS status is now found by reading the
Richard M. Stallman <rms@gnu.org>
parents: 12102
diff changeset
215 (progn (beginning-of-line)
f2519a110e5f The RCS status is now found by reading the
Richard M. Stallman <rms@gnu.org>
parents: 12102
diff changeset
216 (re-search-forward limit nil t)))))))
f2519a110e5f The RCS status is now found by reading the
Richard M. Stallman <rms@gnu.org>
parents: 12102
diff changeset
217 (t (insert-file-contents file)))
f2519a110e5f The RCS status is now found by reading the
Richard M. Stallman <rms@gnu.org>
parents: 12102
diff changeset
218 (set-buffer-modified-p nil)
f2519a110e5f The RCS status is now found by reading the
Richard M. Stallman <rms@gnu.org>
parents: 12102
diff changeset
219 (auto-save-mode nil)
f2519a110e5f The RCS status is now found by reading the
Richard M. Stallman <rms@gnu.org>
parents: 12102
diff changeset
220 t)
f2519a110e5f The RCS status is now found by reading the
Richard M. Stallman <rms@gnu.org>
parents: 12102
diff changeset
221 (t nil)))
f2519a110e5f The RCS status is now found by reading the
Richard M. Stallman <rms@gnu.org>
parents: 12102
diff changeset
222
f2519a110e5f The RCS status is now found by reading the
Richard M. Stallman <rms@gnu.org>
parents: 12102
diff changeset
223 ;;; Access functions to file properties
f2519a110e5f The RCS status is now found by reading the
Richard M. Stallman <rms@gnu.org>
parents: 12102
diff changeset
224 ;;; (Properties should be _set_ using vc-file-setprop, but
f2519a110e5f The RCS status is now found by reading the
Richard M. Stallman <rms@gnu.org>
parents: 12102
diff changeset
225 ;;; _retrieved_ only through these functions, which decide
f2519a110e5f The RCS status is now found by reading the
Richard M. Stallman <rms@gnu.org>
parents: 12102
diff changeset
226 ;;; if the property is already known or not. A property should
31382
cde9770b21e0 Minor doc fixes.
Gerd Moellmann <gerd@gnu.org>
parents: 27262
diff changeset
227 ;;; only be retrieved by vc-file-getprop if there is no
12251
f2519a110e5f The RCS status is now found by reading the
Richard M. Stallman <rms@gnu.org>
parents: 12102
diff changeset
228 ;;; access function.)
11598
540868154dc9 (vc-buffer-backend): New function.
Richard M. Stallman <rms@gnu.org>
parents: 10176
diff changeset
229
31382
cde9770b21e0 Minor doc fixes.
Gerd Moellmann <gerd@gnu.org>
parents: 27262
diff changeset
230 ;;; properties indicating the backend being used for FILE
cde9770b21e0 Minor doc fixes.
Gerd Moellmann <gerd@gnu.org>
parents: 27262
diff changeset
231
cde9770b21e0 Minor doc fixes.
Gerd Moellmann <gerd@gnu.org>
parents: 27262
diff changeset
232 (defun vc-registered (file)
cde9770b21e0 Minor doc fixes.
Gerd Moellmann <gerd@gnu.org>
parents: 27262
diff changeset
233 "Return non-nil if FILE is registered in a version control system.
11604
401afae906eb (vc-default-backend, vc-path, vc-consult-headers):
Karl Heuer <kwzh@gnu.org>
parents: 11598
diff changeset
234
31382
cde9770b21e0 Minor doc fixes.
Gerd Moellmann <gerd@gnu.org>
parents: 27262
diff changeset
235 This function does not cache its result; it performs the test each
cde9770b21e0 Minor doc fixes.
Gerd Moellmann <gerd@gnu.org>
parents: 27262
diff changeset
236 time it is invoked on a file. For a caching check whether a file is
cde9770b21e0 Minor doc fixes.
Gerd Moellmann <gerd@gnu.org>
parents: 27262
diff changeset
237 registered, use `vc-backend'."
cde9770b21e0 Minor doc fixes.
Gerd Moellmann <gerd@gnu.org>
parents: 27262
diff changeset
238 (let (handler)
cde9770b21e0 Minor doc fixes.
Gerd Moellmann <gerd@gnu.org>
parents: 27262
diff changeset
239 (if (boundp 'file-name-handler-alist)
cde9770b21e0 Minor doc fixes.
Gerd Moellmann <gerd@gnu.org>
parents: 27262
diff changeset
240 (setq handler (find-file-name-handler file 'vc-registered)))
cde9770b21e0 Minor doc fixes.
Gerd Moellmann <gerd@gnu.org>
parents: 27262
diff changeset
241 (if handler
cde9770b21e0 Minor doc fixes.
Gerd Moellmann <gerd@gnu.org>
parents: 27262
diff changeset
242 ;; handler should set vc-backend and return t if registered
cde9770b21e0 Minor doc fixes.
Gerd Moellmann <gerd@gnu.org>
parents: 27262
diff changeset
243 (funcall handler 'vc-registered file)
cde9770b21e0 Minor doc fixes.
Gerd Moellmann <gerd@gnu.org>
parents: 27262
diff changeset
244 ;; There is no file name handler.
cde9770b21e0 Minor doc fixes.
Gerd Moellmann <gerd@gnu.org>
parents: 27262
diff changeset
245 ;; Try vc-BACKEND-registered for each handled BACKEND.
cde9770b21e0 Minor doc fixes.
Gerd Moellmann <gerd@gnu.org>
parents: 27262
diff changeset
246 (catch 'found
cde9770b21e0 Minor doc fixes.
Gerd Moellmann <gerd@gnu.org>
parents: 27262
diff changeset
247 (mapcar
cde9770b21e0 Minor doc fixes.
Gerd Moellmann <gerd@gnu.org>
parents: 27262
diff changeset
248 (lambda (b)
cde9770b21e0 Minor doc fixes.
Gerd Moellmann <gerd@gnu.org>
parents: 27262
diff changeset
249 (and (vc-call-backend b 'registered file)
cde9770b21e0 Minor doc fixes.
Gerd Moellmann <gerd@gnu.org>
parents: 27262
diff changeset
250 (vc-file-setprop file 'vc-backend b)
cde9770b21e0 Minor doc fixes.
Gerd Moellmann <gerd@gnu.org>
parents: 27262
diff changeset
251 (throw 'found t)))
cde9770b21e0 Minor doc fixes.
Gerd Moellmann <gerd@gnu.org>
parents: 27262
diff changeset
252 (unless vc-ignore-vc-files
cde9770b21e0 Minor doc fixes.
Gerd Moellmann <gerd@gnu.org>
parents: 27262
diff changeset
253 vc-handled-backends))
cde9770b21e0 Minor doc fixes.
Gerd Moellmann <gerd@gnu.org>
parents: 27262
diff changeset
254 ;; File is not registered.
cde9770b21e0 Minor doc fixes.
Gerd Moellmann <gerd@gnu.org>
parents: 27262
diff changeset
255 (vc-file-setprop file 'vc-backend 'none)
cde9770b21e0 Minor doc fixes.
Gerd Moellmann <gerd@gnu.org>
parents: 27262
diff changeset
256 nil))))
cde9770b21e0 Minor doc fixes.
Gerd Moellmann <gerd@gnu.org>
parents: 27262
diff changeset
257
cde9770b21e0 Minor doc fixes.
Gerd Moellmann <gerd@gnu.org>
parents: 27262
diff changeset
258 (defun vc-backend (file)
cde9770b21e0 Minor doc fixes.
Gerd Moellmann <gerd@gnu.org>
parents: 27262
diff changeset
259 "Return the version control type of FILE, nil if it is not registered."
cde9770b21e0 Minor doc fixes.
Gerd Moellmann <gerd@gnu.org>
parents: 27262
diff changeset
260 ;; `file' can be nil in several places (typically due to the use of
cde9770b21e0 Minor doc fixes.
Gerd Moellmann <gerd@gnu.org>
parents: 27262
diff changeset
261 ;; code like (vc-backend (buffer-file-name))).
cde9770b21e0 Minor doc fixes.
Gerd Moellmann <gerd@gnu.org>
parents: 27262
diff changeset
262 (when (stringp file)
cde9770b21e0 Minor doc fixes.
Gerd Moellmann <gerd@gnu.org>
parents: 27262
diff changeset
263 (let ((property (vc-file-getprop file 'vc-backend)))
cde9770b21e0 Minor doc fixes.
Gerd Moellmann <gerd@gnu.org>
parents: 27262
diff changeset
264 ;; Note that internally, Emacs remembers unregistered
cde9770b21e0 Minor doc fixes.
Gerd Moellmann <gerd@gnu.org>
parents: 27262
diff changeset
265 ;; files by setting the property to `none'.
cde9770b21e0 Minor doc fixes.
Gerd Moellmann <gerd@gnu.org>
parents: 27262
diff changeset
266 (cond ((eq property 'none) nil)
cde9770b21e0 Minor doc fixes.
Gerd Moellmann <gerd@gnu.org>
parents: 27262
diff changeset
267 (property)
cde9770b21e0 Minor doc fixes.
Gerd Moellmann <gerd@gnu.org>
parents: 27262
diff changeset
268 ;; vc-registered sets the vc-backend property
cde9770b21e0 Minor doc fixes.
Gerd Moellmann <gerd@gnu.org>
parents: 27262
diff changeset
269 (t (if (vc-registered file)
cde9770b21e0 Minor doc fixes.
Gerd Moellmann <gerd@gnu.org>
parents: 27262
diff changeset
270 (vc-file-getprop file 'vc-backend)
cde9770b21e0 Minor doc fixes.
Gerd Moellmann <gerd@gnu.org>
parents: 27262
diff changeset
271 nil))))))
cde9770b21e0 Minor doc fixes.
Gerd Moellmann <gerd@gnu.org>
parents: 27262
diff changeset
272
cde9770b21e0 Minor doc fixes.
Gerd Moellmann <gerd@gnu.org>
parents: 27262
diff changeset
273 (defun vc-backend-subdirectory-name (file)
cde9770b21e0 Minor doc fixes.
Gerd Moellmann <gerd@gnu.org>
parents: 27262
diff changeset
274 "Return where the master and lock FILEs for the current directory are kept."
cde9770b21e0 Minor doc fixes.
Gerd Moellmann <gerd@gnu.org>
parents: 27262
diff changeset
275 (symbol-name (vc-backend file)))
11604
401afae906eb (vc-default-backend, vc-path, vc-consult-headers):
Karl Heuer <kwzh@gnu.org>
parents: 11598
diff changeset
276
12251
f2519a110e5f The RCS status is now found by reading the
Richard M. Stallman <rms@gnu.org>
parents: 12102
diff changeset
277 (defun vc-name (file)
31382
cde9770b21e0 Minor doc fixes.
Gerd Moellmann <gerd@gnu.org>
parents: 27262
diff changeset
278 "Return the master name of FILE. If the file is not registered, or
cde9770b21e0 Minor doc fixes.
Gerd Moellmann <gerd@gnu.org>
parents: 27262
diff changeset
279 the master name is not known, return nil."
cde9770b21e0 Minor doc fixes.
Gerd Moellmann <gerd@gnu.org>
parents: 27262
diff changeset
280 ;; TODO: This should ultimately become obsolete, at least up here
cde9770b21e0 Minor doc fixes.
Gerd Moellmann <gerd@gnu.org>
parents: 27262
diff changeset
281 ;; in vc-hooks.
12251
f2519a110e5f The RCS status is now found by reading the
Richard M. Stallman <rms@gnu.org>
parents: 12102
diff changeset
282 (or (vc-file-getprop file 'vc-name)
21356
c714817643a9 (vc-parse-cvs-status): New function.
Richard M. Stallman <rms@gnu.org>
parents: 21232
diff changeset
283 (if (vc-backend file)
c714817643a9 (vc-parse-cvs-status): New function.
Richard M. Stallman <rms@gnu.org>
parents: 21232
diff changeset
284 (vc-file-getprop file 'vc-name))))
11604
401afae906eb (vc-default-backend, vc-path, vc-consult-headers):
Karl Heuer <kwzh@gnu.org>
parents: 11598
diff changeset
285
31382
cde9770b21e0 Minor doc fixes.
Gerd Moellmann <gerd@gnu.org>
parents: 27262
diff changeset
286 (defun vc-checkout-model (file)
cde9770b21e0 Minor doc fixes.
Gerd Moellmann <gerd@gnu.org>
parents: 27262
diff changeset
287 "Indicate how FILE is checked out.
11604
401afae906eb (vc-default-backend, vc-path, vc-consult-headers):
Karl Heuer <kwzh@gnu.org>
parents: 11598
diff changeset
288
31382
cde9770b21e0 Minor doc fixes.
Gerd Moellmann <gerd@gnu.org>
parents: 27262
diff changeset
289 Possible values:
12884
f47248851f26 (vc-fetch-master-properties): Recognize cvs status "Unresolved Conflict".
André Spiegel <spiegel@gnu.org>
parents: 12874
diff changeset
290
31382
cde9770b21e0 Minor doc fixes.
Gerd Moellmann <gerd@gnu.org>
parents: 27262
diff changeset
291 'implicit File is always writeable, and checked out `implicitly'
cde9770b21e0 Minor doc fixes.
Gerd Moellmann <gerd@gnu.org>
parents: 27262
diff changeset
292 when the user saves the first changes to the file.
11604
401afae906eb (vc-default-backend, vc-path, vc-consult-headers):
Karl Heuer <kwzh@gnu.org>
parents: 11598
diff changeset
293
31382
cde9770b21e0 Minor doc fixes.
Gerd Moellmann <gerd@gnu.org>
parents: 27262
diff changeset
294 'locking File is read-only if up-to-date; user must type
cde9770b21e0 Minor doc fixes.
Gerd Moellmann <gerd@gnu.org>
parents: 27262
diff changeset
295 \\[vc-toggle-read-only] before editing. Strict locking
cde9770b21e0 Minor doc fixes.
Gerd Moellmann <gerd@gnu.org>
parents: 27262
diff changeset
296 is assumed.
12251
f2519a110e5f The RCS status is now found by reading the
Richard M. Stallman <rms@gnu.org>
parents: 12102
diff changeset
297
31382
cde9770b21e0 Minor doc fixes.
Gerd Moellmann <gerd@gnu.org>
parents: 27262
diff changeset
298 'announce File is read-only if up-to-date; user must type
cde9770b21e0 Minor doc fixes.
Gerd Moellmann <gerd@gnu.org>
parents: 27262
diff changeset
299 \\[vc-toggle-read-only] before editing. But other users
cde9770b21e0 Minor doc fixes.
Gerd Moellmann <gerd@gnu.org>
parents: 27262
diff changeset
300 may be editing at the same time."
cde9770b21e0 Minor doc fixes.
Gerd Moellmann <gerd@gnu.org>
parents: 27262
diff changeset
301 (or (vc-file-getprop file 'vc-checkout-model)
cde9770b21e0 Minor doc fixes.
Gerd Moellmann <gerd@gnu.org>
parents: 27262
diff changeset
302 (vc-file-setprop file 'vc-checkout-model
cde9770b21e0 Minor doc fixes.
Gerd Moellmann <gerd@gnu.org>
parents: 27262
diff changeset
303 (vc-call checkout-model file))))
12925
77c9a594fe55 (vc-simple-command): New function.
André Spiegel <spiegel@gnu.org>
parents: 12914
diff changeset
304
16742
25558bcdfc93 (vc-user-login-name): New function.
André Spiegel <spiegel@gnu.org>
parents: 16446
diff changeset
305 (defun vc-user-login-name (&optional uid)
31382
cde9770b21e0 Minor doc fixes.
Gerd Moellmann <gerd@gnu.org>
parents: 27262
diff changeset
306 "Return the name under which the user is logged in, as a string.
cde9770b21e0 Minor doc fixes.
Gerd Moellmann <gerd@gnu.org>
parents: 27262
diff changeset
307 \(With optional argument UID, return the name of that user.)
cde9770b21e0 Minor doc fixes.
Gerd Moellmann <gerd@gnu.org>
parents: 27262
diff changeset
308 This function does the same as function `user-login-name', but unlike
cde9770b21e0 Minor doc fixes.
Gerd Moellmann <gerd@gnu.org>
parents: 27262
diff changeset
309 that, it never returns nil. If a UID cannot be resolved, that
cde9770b21e0 Minor doc fixes.
Gerd Moellmann <gerd@gnu.org>
parents: 27262
diff changeset
310 UID is returned as a string."
16742
25558bcdfc93 (vc-user-login-name): New function.
André Spiegel <spiegel@gnu.org>
parents: 16446
diff changeset
311 (or (user-login-name uid)
31382
cde9770b21e0 Minor doc fixes.
Gerd Moellmann <gerd@gnu.org>
parents: 27262
diff changeset
312 (number-to-string (or uid (user-uid)))))
12925
77c9a594fe55 (vc-simple-command): New function.
André Spiegel <spiegel@gnu.org>
parents: 12914
diff changeset
313
31382
cde9770b21e0 Minor doc fixes.
Gerd Moellmann <gerd@gnu.org>
parents: 27262
diff changeset
314 (defun vc-state (file)
cde9770b21e0 Minor doc fixes.
Gerd Moellmann <gerd@gnu.org>
parents: 27262
diff changeset
315 "Return the version control state of FILE.
cde9770b21e0 Minor doc fixes.
Gerd Moellmann <gerd@gnu.org>
parents: 27262
diff changeset
316
cde9770b21e0 Minor doc fixes.
Gerd Moellmann <gerd@gnu.org>
parents: 27262
diff changeset
317 The value returned is one of:
12251
f2519a110e5f The RCS status is now found by reading the
Richard M. Stallman <rms@gnu.org>
parents: 12102
diff changeset
318
31382
cde9770b21e0 Minor doc fixes.
Gerd Moellmann <gerd@gnu.org>
parents: 27262
diff changeset
319 'up-to-date The working file is unmodified with respect to the
cde9770b21e0 Minor doc fixes.
Gerd Moellmann <gerd@gnu.org>
parents: 27262
diff changeset
320 latest version on the current branch, and not locked.
12925
77c9a594fe55 (vc-simple-command): New function.
André Spiegel <spiegel@gnu.org>
parents: 12914
diff changeset
321
31382
cde9770b21e0 Minor doc fixes.
Gerd Moellmann <gerd@gnu.org>
parents: 27262
diff changeset
322 'edited The working file has been edited by the user. If
cde9770b21e0 Minor doc fixes.
Gerd Moellmann <gerd@gnu.org>
parents: 27262
diff changeset
323 locking is used for the file, this state means that
cde9770b21e0 Minor doc fixes.
Gerd Moellmann <gerd@gnu.org>
parents: 27262
diff changeset
324 the current version is locked by the calling user.
12925
77c9a594fe55 (vc-simple-command): New function.
André Spiegel <spiegel@gnu.org>
parents: 12914
diff changeset
325
31382
cde9770b21e0 Minor doc fixes.
Gerd Moellmann <gerd@gnu.org>
parents: 27262
diff changeset
326 USER The current version of the working file is locked by
cde9770b21e0 Minor doc fixes.
Gerd Moellmann <gerd@gnu.org>
parents: 27262
diff changeset
327 some other USER (a string).
cde9770b21e0 Minor doc fixes.
Gerd Moellmann <gerd@gnu.org>
parents: 27262
diff changeset
328
cde9770b21e0 Minor doc fixes.
Gerd Moellmann <gerd@gnu.org>
parents: 27262
diff changeset
329 'needs-patch The file has not been edited by the user, but there is
cde9770b21e0 Minor doc fixes.
Gerd Moellmann <gerd@gnu.org>
parents: 27262
diff changeset
330 a more recent version on the current branch stored
cde9770b21e0 Minor doc fixes.
Gerd Moellmann <gerd@gnu.org>
parents: 27262
diff changeset
331 in the master file.
12251
f2519a110e5f The RCS status is now found by reading the
Richard M. Stallman <rms@gnu.org>
parents: 12102
diff changeset
332
31382
cde9770b21e0 Minor doc fixes.
Gerd Moellmann <gerd@gnu.org>
parents: 27262
diff changeset
333 'needs-merge The file has been edited by the user, and there is also
cde9770b21e0 Minor doc fixes.
Gerd Moellmann <gerd@gnu.org>
parents: 27262
diff changeset
334 a more recent version on the current branch stored in
cde9770b21e0 Minor doc fixes.
Gerd Moellmann <gerd@gnu.org>
parents: 27262
diff changeset
335 the master file. This state can only occur if locking
cde9770b21e0 Minor doc fixes.
Gerd Moellmann <gerd@gnu.org>
parents: 27262
diff changeset
336 is not used for the file.
11604
401afae906eb (vc-default-backend, vc-path, vc-consult-headers):
Karl Heuer <kwzh@gnu.org>
parents: 11598
diff changeset
337
31382
cde9770b21e0 Minor doc fixes.
Gerd Moellmann <gerd@gnu.org>
parents: 27262
diff changeset
338 'unlocked-changes The current version of the working file is not locked,
cde9770b21e0 Minor doc fixes.
Gerd Moellmann <gerd@gnu.org>
parents: 27262
diff changeset
339 but the working file has been changed with respect
cde9770b21e0 Minor doc fixes.
Gerd Moellmann <gerd@gnu.org>
parents: 27262
diff changeset
340 to that version. This state can only occur for files
cde9770b21e0 Minor doc fixes.
Gerd Moellmann <gerd@gnu.org>
parents: 27262
diff changeset
341 with locking; it represents an erroneous condition that
cde9770b21e0 Minor doc fixes.
Gerd Moellmann <gerd@gnu.org>
parents: 27262
diff changeset
342 should be resolved by the user (vc-next-action will
cde9770b21e0 Minor doc fixes.
Gerd Moellmann <gerd@gnu.org>
parents: 27262
diff changeset
343 prompt the user to do it)."
cde9770b21e0 Minor doc fixes.
Gerd Moellmann <gerd@gnu.org>
parents: 27262
diff changeset
344 (or (vc-file-getprop file 'vc-state)
cde9770b21e0 Minor doc fixes.
Gerd Moellmann <gerd@gnu.org>
parents: 27262
diff changeset
345 (vc-file-setprop file 'vc-state
cde9770b21e0 Minor doc fixes.
Gerd Moellmann <gerd@gnu.org>
parents: 27262
diff changeset
346 (vc-call state-heuristic file))))
11604
401afae906eb (vc-default-backend, vc-path, vc-consult-headers):
Karl Heuer <kwzh@gnu.org>
parents: 11598
diff changeset
347
31382
cde9770b21e0 Minor doc fixes.
Gerd Moellmann <gerd@gnu.org>
parents: 27262
diff changeset
348 (defsubst vc-up-to-date-p (file)
cde9770b21e0 Minor doc fixes.
Gerd Moellmann <gerd@gnu.org>
parents: 27262
diff changeset
349 "Convenience function that checks whether `vc-state' of FILE is `up-to-date'."
cde9770b21e0 Minor doc fixes.
Gerd Moellmann <gerd@gnu.org>
parents: 27262
diff changeset
350 (eq (vc-state file) 'up-to-date))
cde9770b21e0 Minor doc fixes.
Gerd Moellmann <gerd@gnu.org>
parents: 27262
diff changeset
351
cde9770b21e0 Minor doc fixes.
Gerd Moellmann <gerd@gnu.org>
parents: 27262
diff changeset
352 (defun vc-default-state-heuristic (backend file)
cde9770b21e0 Minor doc fixes.
Gerd Moellmann <gerd@gnu.org>
parents: 27262
diff changeset
353 "Default implementation of vc-state-heuristic. It simply calls the
cde9770b21e0 Minor doc fixes.
Gerd Moellmann <gerd@gnu.org>
parents: 27262
diff changeset
354 real state computation function `vc-BACKEND-state' and does not employ
cde9770b21e0 Minor doc fixes.
Gerd Moellmann <gerd@gnu.org>
parents: 27262
diff changeset
355 any heuristic at all."
cde9770b21e0 Minor doc fixes.
Gerd Moellmann <gerd@gnu.org>
parents: 27262
diff changeset
356 (vc-call-backend backend 'state file))
12252
e07d55d05864 (vc-fetch-master-properties): For RCS file,
Richard M. Stallman <rms@gnu.org>
parents: 12251
diff changeset
357
11604
401afae906eb (vc-default-backend, vc-path, vc-consult-headers):
Karl Heuer <kwzh@gnu.org>
parents: 11598
diff changeset
358 (defun vc-workfile-version (file)
31382
cde9770b21e0 Minor doc fixes.
Gerd Moellmann <gerd@gnu.org>
parents: 27262
diff changeset
359 "Return version level of the current workfile FILE."
cde9770b21e0 Minor doc fixes.
Gerd Moellmann <gerd@gnu.org>
parents: 27262
diff changeset
360 (or (vc-file-getprop file 'vc-workfile-version)
cde9770b21e0 Minor doc fixes.
Gerd Moellmann <gerd@gnu.org>
parents: 27262
diff changeset
361 (vc-file-setprop file 'vc-workfile-version
cde9770b21e0 Minor doc fixes.
Gerd Moellmann <gerd@gnu.org>
parents: 27262
diff changeset
362 (vc-call workfile-version file))))
11598
540868154dc9 (vc-buffer-backend): New function.
Richard M. Stallman <rms@gnu.org>
parents: 10176
diff changeset
363
904
4a1ac370d57a Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
364 ;;; actual version-control code starts here
4a1ac370d57a Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
365
31382
cde9770b21e0 Minor doc fixes.
Gerd Moellmann <gerd@gnu.org>
parents: 27262
diff changeset
366 (defun vc-default-registered (backend file)
cde9770b21e0 Minor doc fixes.
Gerd Moellmann <gerd@gnu.org>
parents: 27262
diff changeset
367 "Check if FILE is registered in BACKEND using vc-BACKEND-master-templates."
cde9770b21e0 Minor doc fixes.
Gerd Moellmann <gerd@gnu.org>
parents: 27262
diff changeset
368 (let ((sym (vc-make-backend-sym backend 'master-templates)))
cde9770b21e0 Minor doc fixes.
Gerd Moellmann <gerd@gnu.org>
parents: 27262
diff changeset
369 (unless (get backend 'vc-templates-grabbed)
cde9770b21e0 Minor doc fixes.
Gerd Moellmann <gerd@gnu.org>
parents: 27262
diff changeset
370 (put backend 'vc-templates-grabbed t)
cde9770b21e0 Minor doc fixes.
Gerd Moellmann <gerd@gnu.org>
parents: 27262
diff changeset
371 (set sym (append (delq nil
cde9770b21e0 Minor doc fixes.
Gerd Moellmann <gerd@gnu.org>
parents: 27262
diff changeset
372 (mapcar
cde9770b21e0 Minor doc fixes.
Gerd Moellmann <gerd@gnu.org>
parents: 27262
diff changeset
373 (lambda (template)
cde9770b21e0 Minor doc fixes.
Gerd Moellmann <gerd@gnu.org>
parents: 27262
diff changeset
374 (and (consp template)
cde9770b21e0 Minor doc fixes.
Gerd Moellmann <gerd@gnu.org>
parents: 27262
diff changeset
375 (eq (cdr template) backend)
cde9770b21e0 Minor doc fixes.
Gerd Moellmann <gerd@gnu.org>
parents: 27262
diff changeset
376 (car template)))
cde9770b21e0 Minor doc fixes.
Gerd Moellmann <gerd@gnu.org>
parents: 27262
diff changeset
377 vc-master-templates))
cde9770b21e0 Minor doc fixes.
Gerd Moellmann <gerd@gnu.org>
parents: 27262
diff changeset
378 (symbol-value sym))))
cde9770b21e0 Minor doc fixes.
Gerd Moellmann <gerd@gnu.org>
parents: 27262
diff changeset
379 (let ((result (vc-check-master-templates file (symbol-value sym))))
cde9770b21e0 Minor doc fixes.
Gerd Moellmann <gerd@gnu.org>
parents: 27262
diff changeset
380 (if (stringp result)
cde9770b21e0 Minor doc fixes.
Gerd Moellmann <gerd@gnu.org>
parents: 27262
diff changeset
381 (vc-file-setprop file 'vc-name result)
cde9770b21e0 Minor doc fixes.
Gerd Moellmann <gerd@gnu.org>
parents: 27262
diff changeset
382 nil)))) ; Not registered
904
4a1ac370d57a Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
383
31382
cde9770b21e0 Minor doc fixes.
Gerd Moellmann <gerd@gnu.org>
parents: 27262
diff changeset
384 (defun vc-possible-master (s dirname basename)
cde9770b21e0 Minor doc fixes.
Gerd Moellmann <gerd@gnu.org>
parents: 27262
diff changeset
385 (cond
cde9770b21e0 Minor doc fixes.
Gerd Moellmann <gerd@gnu.org>
parents: 27262
diff changeset
386 ((stringp s) (format s dirname basename))
cde9770b21e0 Minor doc fixes.
Gerd Moellmann <gerd@gnu.org>
parents: 27262
diff changeset
387 ((functionp s)
cde9770b21e0 Minor doc fixes.
Gerd Moellmann <gerd@gnu.org>
parents: 27262
diff changeset
388 ;; The template is a function to invoke. If the
cde9770b21e0 Minor doc fixes.
Gerd Moellmann <gerd@gnu.org>
parents: 27262
diff changeset
389 ;; function returns non-nil, that means it has found a
cde9770b21e0 Minor doc fixes.
Gerd Moellmann <gerd@gnu.org>
parents: 27262
diff changeset
390 ;; master. For backward compatibility, we also handle
cde9770b21e0 Minor doc fixes.
Gerd Moellmann <gerd@gnu.org>
parents: 27262
diff changeset
391 ;; the case that the function throws a 'found atom
cde9770b21e0 Minor doc fixes.
Gerd Moellmann <gerd@gnu.org>
parents: 27262
diff changeset
392 ;; and a pair (cons MASTER-FILE BACKEND).
cde9770b21e0 Minor doc fixes.
Gerd Moellmann <gerd@gnu.org>
parents: 27262
diff changeset
393 (let ((result (catch 'found (funcall s dirname basename))))
cde9770b21e0 Minor doc fixes.
Gerd Moellmann <gerd@gnu.org>
parents: 27262
diff changeset
394 (if (consp result) (car result) result)))))
21232
b682a769996d (vc-sccs-project-dir, vc-search-sccs-project-dir): New functions.
André Spiegel <spiegel@gnu.org>
parents: 20989
diff changeset
395
31382
cde9770b21e0 Minor doc fixes.
Gerd Moellmann <gerd@gnu.org>
parents: 27262
diff changeset
396 (defun vc-check-master-templates (file templates)
cde9770b21e0 Minor doc fixes.
Gerd Moellmann <gerd@gnu.org>
parents: 27262
diff changeset
397 "Return non-nil if there is a master corresponding to FILE,
cde9770b21e0 Minor doc fixes.
Gerd Moellmann <gerd@gnu.org>
parents: 27262
diff changeset
398 according to any of the elements in TEMPLATES.
cde9770b21e0 Minor doc fixes.
Gerd Moellmann <gerd@gnu.org>
parents: 27262
diff changeset
399
cde9770b21e0 Minor doc fixes.
Gerd Moellmann <gerd@gnu.org>
parents: 27262
diff changeset
400 TEMPLATES is a list of strings or functions. If an element is a
cde9770b21e0 Minor doc fixes.
Gerd Moellmann <gerd@gnu.org>
parents: 27262
diff changeset
401 string, it must be a control string as required by `format', with two
cde9770b21e0 Minor doc fixes.
Gerd Moellmann <gerd@gnu.org>
parents: 27262
diff changeset
402 string placeholders, such as \"%sRCS/%s,v\". The directory part of
cde9770b21e0 Minor doc fixes.
Gerd Moellmann <gerd@gnu.org>
parents: 27262
diff changeset
403 FILE is substituted for the first placeholder, the basename of FILE
cde9770b21e0 Minor doc fixes.
Gerd Moellmann <gerd@gnu.org>
parents: 27262
diff changeset
404 for the second. If a file with the resulting name exists, it is taken
cde9770b21e0 Minor doc fixes.
Gerd Moellmann <gerd@gnu.org>
parents: 27262
diff changeset
405 as the master of FILE, and returned.
9248
325cee61ab7f (vc-status): Handle CVS.
Richard M. Stallman <rms@gnu.org>
parents: 8982
diff changeset
406
31382
cde9770b21e0 Minor doc fixes.
Gerd Moellmann <gerd@gnu.org>
parents: 27262
diff changeset
407 If an element of TEMPLATES is a function, it is called with the
cde9770b21e0 Minor doc fixes.
Gerd Moellmann <gerd@gnu.org>
parents: 27262
diff changeset
408 directory part and the basename of FILE as arguments. It should
cde9770b21e0 Minor doc fixes.
Gerd Moellmann <gerd@gnu.org>
parents: 27262
diff changeset
409 return non-nil if it finds a master; that value is then returned by
cde9770b21e0 Minor doc fixes.
Gerd Moellmann <gerd@gnu.org>
parents: 27262
diff changeset
410 this function."
cde9770b21e0 Minor doc fixes.
Gerd Moellmann <gerd@gnu.org>
parents: 27262
diff changeset
411 (let ((dirname (or (file-name-directory file) ""))
cde9770b21e0 Minor doc fixes.
Gerd Moellmann <gerd@gnu.org>
parents: 27262
diff changeset
412 (basename (file-name-nondirectory file)))
cde9770b21e0 Minor doc fixes.
Gerd Moellmann <gerd@gnu.org>
parents: 27262
diff changeset
413 (catch 'found
cde9770b21e0 Minor doc fixes.
Gerd Moellmann <gerd@gnu.org>
parents: 27262
diff changeset
414 (mapcar
cde9770b21e0 Minor doc fixes.
Gerd Moellmann <gerd@gnu.org>
parents: 27262
diff changeset
415 (lambda (s)
cde9770b21e0 Minor doc fixes.
Gerd Moellmann <gerd@gnu.org>
parents: 27262
diff changeset
416 (let ((trial (vc-possible-master s dirname basename)))
cde9770b21e0 Minor doc fixes.
Gerd Moellmann <gerd@gnu.org>
parents: 27262
diff changeset
417 (if (and trial (file-exists-p trial)
cde9770b21e0 Minor doc fixes.
Gerd Moellmann <gerd@gnu.org>
parents: 27262
diff changeset
418 ;; Make sure the file we found with name
cde9770b21e0 Minor doc fixes.
Gerd Moellmann <gerd@gnu.org>
parents: 27262
diff changeset
419 ;; TRIAL is not the source file itself.
cde9770b21e0 Minor doc fixes.
Gerd Moellmann <gerd@gnu.org>
parents: 27262
diff changeset
420 ;; That can happen with RCS-style names if
cde9770b21e0 Minor doc fixes.
Gerd Moellmann <gerd@gnu.org>
parents: 27262
diff changeset
421 ;; the file name is truncated (e.g. to 14
cde9770b21e0 Minor doc fixes.
Gerd Moellmann <gerd@gnu.org>
parents: 27262
diff changeset
422 ;; chars). See if either directory or
cde9770b21e0 Minor doc fixes.
Gerd Moellmann <gerd@gnu.org>
parents: 27262
diff changeset
423 ;; attributes differ.
cde9770b21e0 Minor doc fixes.
Gerd Moellmann <gerd@gnu.org>
parents: 27262
diff changeset
424 (or (not (string= dirname
cde9770b21e0 Minor doc fixes.
Gerd Moellmann <gerd@gnu.org>
parents: 27262
diff changeset
425 (file-name-directory trial)))
cde9770b21e0 Minor doc fixes.
Gerd Moellmann <gerd@gnu.org>
parents: 27262
diff changeset
426 (not (equal (file-attributes file)
cde9770b21e0 Minor doc fixes.
Gerd Moellmann <gerd@gnu.org>
parents: 27262
diff changeset
427 (file-attributes trial)))))
cde9770b21e0 Minor doc fixes.
Gerd Moellmann <gerd@gnu.org>
parents: 27262
diff changeset
428 (throw 'found trial))))
cde9770b21e0 Minor doc fixes.
Gerd Moellmann <gerd@gnu.org>
parents: 27262
diff changeset
429 templates))))
11598
540868154dc9 (vc-buffer-backend): New function.
Richard M. Stallman <rms@gnu.org>
parents: 10176
diff changeset
430
10176
332014233a2c (vc-toggle-read-only): Accept prefix arg
Richard M. Stallman <rms@gnu.org>
parents: 9869
diff changeset
431 (defun vc-toggle-read-only (&optional verbose)
2620
d26f75fd9f5e (vc-mode-line): Don't alter key bindings.
Richard M. Stallman <rms@gnu.org>
parents: 2491
diff changeset
432 "Change read-only status of current buffer, perhaps via version control.
d26f75fd9f5e (vc-mode-line): Don't alter key bindings.
Richard M. Stallman <rms@gnu.org>
parents: 2491
diff changeset
433 If the buffer is visiting a file registered with version control,
d26f75fd9f5e (vc-mode-line): Don't alter key bindings.
Richard M. Stallman <rms@gnu.org>
parents: 2491
diff changeset
434 then check the file in or out. Otherwise, just change the read-only flag
23693
295cf395a392 (vc-toggle-read-only): Doc fix.
Karl Heuer <kwzh@gnu.org>
parents: 23255
diff changeset
435 of the buffer.
295cf395a392 (vc-toggle-read-only): Doc fix.
Karl Heuer <kwzh@gnu.org>
parents: 23255
diff changeset
436 With prefix argument, ask for version number to check in or check out.
295cf395a392 (vc-toggle-read-only): Doc fix.
Karl Heuer <kwzh@gnu.org>
parents: 23255
diff changeset
437 Check-out of a specified version number does not lock the file;
295cf395a392 (vc-toggle-read-only): Doc fix.
Karl Heuer <kwzh@gnu.org>
parents: 23255
diff changeset
438 to do that, use this command a second time with no argument."
10176
332014233a2c (vc-toggle-read-only): Accept prefix arg
Richard M. Stallman <rms@gnu.org>
parents: 9869
diff changeset
439 (interactive "P")
18850
238067491696 (vc-find-cvs-master): Corrected parsing of CVS/Entries, according to CVS docs.
André Spiegel <spiegel@gnu.org>
parents: 18403
diff changeset
440 (if (or (and (boundp 'vc-dired-mode) vc-dired-mode)
31382
cde9770b21e0 Minor doc fixes.
Gerd Moellmann <gerd@gnu.org>
parents: 27262
diff changeset
441 ;; use boundp because vc.el might not be loaded
cde9770b21e0 Minor doc fixes.
Gerd Moellmann <gerd@gnu.org>
parents: 27262
diff changeset
442 (vc-backend (buffer-file-name)))
10176
332014233a2c (vc-toggle-read-only): Accept prefix arg
Richard M. Stallman <rms@gnu.org>
parents: 9869
diff changeset
443 (vc-next-action verbose)
904
4a1ac370d57a Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
444 (toggle-read-only)))
2620
d26f75fd9f5e (vc-mode-line): Don't alter key bindings.
Richard M. Stallman <rms@gnu.org>
parents: 2491
diff changeset
445 (define-key global-map "\C-x\C-q" 'vc-toggle-read-only)
904
4a1ac370d57a Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
446
12914
22f47b2375c1 (vc-fetch-master-properties): RCS case: get locking mode.
André Spiegel <spiegel@gnu.org>
parents: 12884
diff changeset
447 (defun vc-after-save ()
31382
cde9770b21e0 Minor doc fixes.
Gerd Moellmann <gerd@gnu.org>
parents: 27262
diff changeset
448 "Function to be called by `basic-save-buffer' (in files.el)."
cde9770b21e0 Minor doc fixes.
Gerd Moellmann <gerd@gnu.org>
parents: 27262
diff changeset
449 ;; If the file in the current buffer is under version control,
cde9770b21e0 Minor doc fixes.
Gerd Moellmann <gerd@gnu.org>
parents: 27262
diff changeset
450 ;; up-to-date, and locking is not used for the file, set
cde9770b21e0 Minor doc fixes.
Gerd Moellmann <gerd@gnu.org>
parents: 27262
diff changeset
451 ;; the state to 'edited and redisplay the mode line.
12914
22f47b2375c1 (vc-fetch-master-properties): RCS case: get locking mode.
André Spiegel <spiegel@gnu.org>
parents: 12884
diff changeset
452 (let ((file (buffer-file-name)))
21356
c714817643a9 (vc-parse-cvs-status): New function.
Richard M. Stallman <rms@gnu.org>
parents: 21232
diff changeset
453 (and (vc-backend file)
12967
ee545522ef2a (vc-utc-string): New function.
André Spiegel <spiegel@gnu.org>
parents: 12944
diff changeset
454 (or (and (equal (vc-file-getprop file 'vc-checkout-time)
ee545522ef2a (vc-utc-string): New function.
André Spiegel <spiegel@gnu.org>
parents: 12944
diff changeset
455 (nth 5 (file-attributes file)))
ee545522ef2a (vc-utc-string): New function.
André Spiegel <spiegel@gnu.org>
parents: 12944
diff changeset
456 ;; File has been saved in the same second in which
ee545522ef2a (vc-utc-string): New function.
André Spiegel <spiegel@gnu.org>
parents: 12944
diff changeset
457 ;; it was checked out. Clear the checkout-time
ee545522ef2a (vc-utc-string): New function.
André Spiegel <spiegel@gnu.org>
parents: 12944
diff changeset
458 ;; to avoid confusion.
ee545522ef2a (vc-utc-string): New function.
André Spiegel <spiegel@gnu.org>
parents: 12944
diff changeset
459 (vc-file-setprop file 'vc-checkout-time nil))
ee545522ef2a (vc-utc-string): New function.
André Spiegel <spiegel@gnu.org>
parents: 12944
diff changeset
460 t)
31382
cde9770b21e0 Minor doc fixes.
Gerd Moellmann <gerd@gnu.org>
parents: 27262
diff changeset
461 (vc-up-to-date-p file)
cde9770b21e0 Minor doc fixes.
Gerd Moellmann <gerd@gnu.org>
parents: 27262
diff changeset
462 (eq (vc-checkout-model file) 'implicit)
cde9770b21e0 Minor doc fixes.
Gerd Moellmann <gerd@gnu.org>
parents: 27262
diff changeset
463 (vc-file-setprop file 'vc-state 'edited)
cde9770b21e0 Minor doc fixes.
Gerd Moellmann <gerd@gnu.org>
parents: 27262
diff changeset
464 (vc-mode-line file)
cde9770b21e0 Minor doc fixes.
Gerd Moellmann <gerd@gnu.org>
parents: 27262
diff changeset
465 (vc-dired-resynch-file file))))
12884
f47248851f26 (vc-fetch-master-properties): Recognize cvs status "Unresolved Conflict".
André Spiegel <spiegel@gnu.org>
parents: 12874
diff changeset
466
31382
cde9770b21e0 Minor doc fixes.
Gerd Moellmann <gerd@gnu.org>
parents: 27262
diff changeset
467 (defun vc-mode-line (file)
2491
5f3061858f47 vc-mode: name change.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 2232
diff changeset
468 "Set `vc-mode' to display type of version control for FILE.
904
4a1ac370d57a Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
469 The value is set in the current buffer, which should be the buffer
31382
cde9770b21e0 Minor doc fixes.
Gerd Moellmann <gerd@gnu.org>
parents: 27262
diff changeset
470 visiting FILE."
2218
13be90dfef0c Merge today's change by eric with everybody else's
Paul Eggert <eggert@twinsun.com>
parents: 2213
diff changeset
471 (interactive (list buffer-file-name nil))
31382
cde9770b21e0 Minor doc fixes.
Gerd Moellmann <gerd@gnu.org>
parents: 27262
diff changeset
472 (unless (not (vc-backend file))
cde9770b21e0 Minor doc fixes.
Gerd Moellmann <gerd@gnu.org>
parents: 27262
diff changeset
473 (setq vc-mode (concat " "
cde9770b21e0 Minor doc fixes.
Gerd Moellmann <gerd@gnu.org>
parents: 27262
diff changeset
474 (if vc-display-status
cde9770b21e0 Minor doc fixes.
Gerd Moellmann <gerd@gnu.org>
parents: 27262
diff changeset
475 (vc-call mode-line-string file)
cde9770b21e0 Minor doc fixes.
Gerd Moellmann <gerd@gnu.org>
parents: 27262
diff changeset
476 (symbol-name (vc-backend file)))))
15448
593dadb4f287 (vc-mode-line): If user is root, verify file really has user-writable bit.
Richard M. Stallman <rms@gnu.org>
parents: 15196
diff changeset
477 ;; If the file is locked by some other user, make
593dadb4f287 (vc-mode-line): If user is root, verify file really has user-writable bit.
Richard M. Stallman <rms@gnu.org>
parents: 15196
diff changeset
478 ;; the buffer read-only. Like this, even root
15517
d9bb8f6b05a0 Comment changes.
Richard M. Stallman <rms@gnu.org>
parents: 15448
diff changeset
479 ;; cannot modify a file that someone else has locked.
31382
cde9770b21e0 Minor doc fixes.
Gerd Moellmann <gerd@gnu.org>
parents: 27262
diff changeset
480 (and (equal file (buffer-file-name))
cde9770b21e0 Minor doc fixes.
Gerd Moellmann <gerd@gnu.org>
parents: 27262
diff changeset
481 (stringp (vc-state file))
12914
22f47b2375c1 (vc-fetch-master-properties): RCS case: get locking mode.
André Spiegel <spiegel@gnu.org>
parents: 12884
diff changeset
482 (setq buffer-read-only t))
15517
d9bb8f6b05a0 Comment changes.
Richard M. Stallman <rms@gnu.org>
parents: 15448
diff changeset
483 ;; If the user is root, and the file is not owner-writable,
d9bb8f6b05a0 Comment changes.
Richard M. Stallman <rms@gnu.org>
parents: 15448
diff changeset
484 ;; then pretend that we can't write it
d9bb8f6b05a0 Comment changes.
Richard M. Stallman <rms@gnu.org>
parents: 15448
diff changeset
485 ;; even though we can (because root can write anything).
d9bb8f6b05a0 Comment changes.
Richard M. Stallman <rms@gnu.org>
parents: 15448
diff changeset
486 ;; This way, even root cannot modify a file that isn't locked.
31382
cde9770b21e0 Minor doc fixes.
Gerd Moellmann <gerd@gnu.org>
parents: 27262
diff changeset
487 (and (equal file (buffer-file-name))
15448
593dadb4f287 (vc-mode-line): If user is root, verify file really has user-writable bit.
Richard M. Stallman <rms@gnu.org>
parents: 15196
diff changeset
488 (not buffer-read-only)
593dadb4f287 (vc-mode-line): If user is root, verify file really has user-writable bit.
Richard M. Stallman <rms@gnu.org>
parents: 15196
diff changeset
489 (zerop (user-real-uid))
593dadb4f287 (vc-mode-line): If user is root, verify file really has user-writable bit.
Richard M. Stallman <rms@gnu.org>
parents: 15196
diff changeset
490 (zerop (logand (file-modes (buffer-file-name)) 128))
31382
cde9770b21e0 Minor doc fixes.
Gerd Moellmann <gerd@gnu.org>
parents: 27262
diff changeset
491 (setq buffer-read-only t)))
cde9770b21e0 Minor doc fixes.
Gerd Moellmann <gerd@gnu.org>
parents: 27262
diff changeset
492 (force-mode-line-update)
cde9770b21e0 Minor doc fixes.
Gerd Moellmann <gerd@gnu.org>
parents: 27262
diff changeset
493 (vc-backend file))
cde9770b21e0 Minor doc fixes.
Gerd Moellmann <gerd@gnu.org>
parents: 27262
diff changeset
494
cde9770b21e0 Minor doc fixes.
Gerd Moellmann <gerd@gnu.org>
parents: 27262
diff changeset
495 (defun vc-default-mode-line-string (backend file)
cde9770b21e0 Minor doc fixes.
Gerd Moellmann <gerd@gnu.org>
parents: 27262
diff changeset
496 "Return string for placement in modeline by `vc-mode-line' for FILE.
cde9770b21e0 Minor doc fixes.
Gerd Moellmann <gerd@gnu.org>
parents: 27262
diff changeset
497 Format:
cde9770b21e0 Minor doc fixes.
Gerd Moellmann <gerd@gnu.org>
parents: 27262
diff changeset
498
cde9770b21e0 Minor doc fixes.
Gerd Moellmann <gerd@gnu.org>
parents: 27262
diff changeset
499 \"BACKEND-REV\" if the file is up-to-date
cde9770b21e0 Minor doc fixes.
Gerd Moellmann <gerd@gnu.org>
parents: 27262
diff changeset
500 \"BACKEND:REV\" if the file is edited (or locked by the calling user)
cde9770b21e0 Minor doc fixes.
Gerd Moellmann <gerd@gnu.org>
parents: 27262
diff changeset
501 \"BACKEND:LOCKER:REV\" if the file is locked by somebody else
cde9770b21e0 Minor doc fixes.
Gerd Moellmann <gerd@gnu.org>
parents: 27262
diff changeset
502 \"BACKEND @@\" for a CVS file that is added, but not yet committed
904
4a1ac370d57a Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
503
31382
cde9770b21e0 Minor doc fixes.
Gerd Moellmann <gerd@gnu.org>
parents: 27262
diff changeset
504 This function assumes that the file is registered."
cde9770b21e0 Minor doc fixes.
Gerd Moellmann <gerd@gnu.org>
parents: 27262
diff changeset
505 (setq backend (symbol-name backend))
cde9770b21e0 Minor doc fixes.
Gerd Moellmann <gerd@gnu.org>
parents: 27262
diff changeset
506 (let ((state (vc-state file))
cde9770b21e0 Minor doc fixes.
Gerd Moellmann <gerd@gnu.org>
parents: 27262
diff changeset
507 (rev (vc-workfile-version file)))
11604
401afae906eb (vc-default-backend, vc-path, vc-consult-headers):
Karl Heuer <kwzh@gnu.org>
parents: 11598
diff changeset
508 (cond ((string= "0" rev)
31382
cde9770b21e0 Minor doc fixes.
Gerd Moellmann <gerd@gnu.org>
parents: 27262
diff changeset
509 ;; CVS special case; should go into a CVS-specific implementation
cde9770b21e0 Minor doc fixes.
Gerd Moellmann <gerd@gnu.org>
parents: 27262
diff changeset
510 (concat backend " @@"))
cde9770b21e0 Minor doc fixes.
Gerd Moellmann <gerd@gnu.org>
parents: 27262
diff changeset
511 ((or (eq state 'up-to-date)
cde9770b21e0 Minor doc fixes.
Gerd Moellmann <gerd@gnu.org>
parents: 27262
diff changeset
512 (eq state 'needs-patch))
cde9770b21e0 Minor doc fixes.
Gerd Moellmann <gerd@gnu.org>
parents: 27262
diff changeset
513 (concat backend "-" rev))
cde9770b21e0 Minor doc fixes.
Gerd Moellmann <gerd@gnu.org>
parents: 27262
diff changeset
514 ((stringp state)
cde9770b21e0 Minor doc fixes.
Gerd Moellmann <gerd@gnu.org>
parents: 27262
diff changeset
515 (concat backend ":" state ":" rev))
cde9770b21e0 Minor doc fixes.
Gerd Moellmann <gerd@gnu.org>
parents: 27262
diff changeset
516 (t
cde9770b21e0 Minor doc fixes.
Gerd Moellmann <gerd@gnu.org>
parents: 27262
diff changeset
517 ;; Not just for the 'edited state, but also a fallback
cde9770b21e0 Minor doc fixes.
Gerd Moellmann <gerd@gnu.org>
parents: 27262
diff changeset
518 ;; for all other states. Think about different symbols
cde9770b21e0 Minor doc fixes.
Gerd Moellmann <gerd@gnu.org>
parents: 27262
diff changeset
519 ;; for 'needs-patch and 'needs-merge.
cde9770b21e0 Minor doc fixes.
Gerd Moellmann <gerd@gnu.org>
parents: 27262
diff changeset
520 (concat backend ":" rev)))))
11598
540868154dc9 (vc-buffer-backend): New function.
Richard M. Stallman <rms@gnu.org>
parents: 10176
diff changeset
521
14647
b1a88c3a6912 (vc-follow-link): New function.
André Spiegel <spiegel@gnu.org>
parents: 14622
diff changeset
522 (defun vc-follow-link ()
31382
cde9770b21e0 Minor doc fixes.
Gerd Moellmann <gerd@gnu.org>
parents: 27262
diff changeset
523 "If current buffer visits a symbolic link, visit the real file.
cde9770b21e0 Minor doc fixes.
Gerd Moellmann <gerd@gnu.org>
parents: 27262
diff changeset
524 If the real file is already visited in another buffer, make that buffer
cde9770b21e0 Minor doc fixes.
Gerd Moellmann <gerd@gnu.org>
parents: 27262
diff changeset
525 current, and kill the buffer that visits the link."
15161
ea07411f268e (vc-follow-link, vc-find-file-hook):
Richard M. Stallman <rms@gnu.org>
parents: 14734
diff changeset
526 (let* ((truename (abbreviate-file-name (file-chase-links buffer-file-name)))
14673
8f8a4224147b (vc-follow-link): Simplify by taking advantage
Richard M. Stallman <rms@gnu.org>
parents: 14647
diff changeset
527 (true-buffer (find-buffer-visiting truename))
8f8a4224147b (vc-follow-link): Simplify by taking advantage
Richard M. Stallman <rms@gnu.org>
parents: 14647
diff changeset
528 (this-buffer (current-buffer)))
8f8a4224147b (vc-follow-link): Simplify by taking advantage
Richard M. Stallman <rms@gnu.org>
parents: 14647
diff changeset
529 (if (eq true-buffer this-buffer)
8f8a4224147b (vc-follow-link): Simplify by taking advantage
Richard M. Stallman <rms@gnu.org>
parents: 14647
diff changeset
530 (progn
14674
f585d3bf3a73 (vc-follow-link): Kill buffer before creating new one.
Richard M. Stallman <rms@gnu.org>
parents: 14673
diff changeset
531 (kill-buffer this-buffer)
14673
8f8a4224147b (vc-follow-link): Simplify by taking advantage
Richard M. Stallman <rms@gnu.org>
parents: 14647
diff changeset
532 ;; In principle, we could do something like set-visited-file-name.
8f8a4224147b (vc-follow-link): Simplify by taking advantage
Richard M. Stallman <rms@gnu.org>
parents: 14647
diff changeset
533 ;; However, it can't be exactly the same as set-visited-file-name.
8f8a4224147b (vc-follow-link): Simplify by taking advantage
Richard M. Stallman <rms@gnu.org>
parents: 14647
diff changeset
534 ;; I'm not going to work out the details right now. -- rms.
14674
f585d3bf3a73 (vc-follow-link): Kill buffer before creating new one.
Richard M. Stallman <rms@gnu.org>
parents: 14673
diff changeset
535 (set-buffer (find-file-noselect truename)))
14673
8f8a4224147b (vc-follow-link): Simplify by taking advantage
Richard M. Stallman <rms@gnu.org>
parents: 14647
diff changeset
536 (set-buffer true-buffer)
8f8a4224147b (vc-follow-link): Simplify by taking advantage
Richard M. Stallman <rms@gnu.org>
parents: 14647
diff changeset
537 (kill-buffer this-buffer))))
14647
b1a88c3a6912 (vc-follow-link): New function.
André Spiegel <spiegel@gnu.org>
parents: 14622
diff changeset
538
904
4a1ac370d57a Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
539 (defun vc-find-file-hook ()
31382
cde9770b21e0 Minor doc fixes.
Gerd Moellmann <gerd@gnu.org>
parents: 27262
diff changeset
540 "Function for `find-file-hooks' activating VC mode if appropriate."
2218
13be90dfef0c Merge today's change by eric with everybody else's
Paul Eggert <eggert@twinsun.com>
parents: 2213
diff changeset
541 ;; Recompute whether file is version controlled,
13be90dfef0c Merge today's change by eric with everybody else's
Paul Eggert <eggert@twinsun.com>
parents: 2213
diff changeset
542 ;; if user has killed the buffer and revisited.
31382
cde9770b21e0 Minor doc fixes.
Gerd Moellmann <gerd@gnu.org>
parents: 27262
diff changeset
543 (when buffer-file-name
11598
540868154dc9 (vc-buffer-backend): New function.
Richard M. Stallman <rms@gnu.org>
parents: 10176
diff changeset
544 (vc-file-clearprops buffer-file-name)
540868154dc9 (vc-buffer-backend): New function.
Richard M. Stallman <rms@gnu.org>
parents: 10176
diff changeset
545 (cond
11604
401afae906eb (vc-default-backend, vc-path, vc-consult-headers):
Karl Heuer <kwzh@gnu.org>
parents: 11598
diff changeset
546 ((vc-backend buffer-file-name)
11598
540868154dc9 (vc-buffer-backend): New function.
Richard M. Stallman <rms@gnu.org>
parents: 10176
diff changeset
547 (vc-mode-line buffer-file-name)
540868154dc9 (vc-buffer-backend): New function.
Richard M. Stallman <rms@gnu.org>
parents: 10176
diff changeset
548 (cond ((not vc-make-backup-files)
540868154dc9 (vc-buffer-backend): New function.
Richard M. Stallman <rms@gnu.org>
parents: 10176
diff changeset
549 ;; Use this variable, not make-backup-files,
540868154dc9 (vc-buffer-backend): New function.
Richard M. Stallman <rms@gnu.org>
parents: 10176
diff changeset
550 ;; because this is for things that depend on the file name.
540868154dc9 (vc-buffer-backend): New function.
Richard M. Stallman <rms@gnu.org>
parents: 10176
diff changeset
551 (make-local-variable 'backup-inhibited)
12590
a771c59393e7 (vc-mode-line, vc-find-file-hook): Moved the test for
Richard M. Stallman <rms@gnu.org>
parents: 12561
diff changeset
552 (setq backup-inhibited t))))
a771c59393e7 (vc-mode-line, vc-find-file-hook): Moved the test for
Richard M. Stallman <rms@gnu.org>
parents: 12561
diff changeset
553 ((let* ((link (file-symlink-p buffer-file-name))
15196
414e523050d5 (vc-find-file-hook): Follow multiple links all the way.
Richard M. Stallman <rms@gnu.org>
parents: 15161
diff changeset
554 (link-type (and link (vc-backend (file-chase-links link)))))
12590
a771c59393e7 (vc-mode-line, vc-find-file-hook): Moved the test for
Richard M. Stallman <rms@gnu.org>
parents: 12561
diff changeset
555 (if link-type
14142
c9cb9dbb2d40 (vc-follow-symlinks): New variable.
André Spiegel <spiegel@gnu.org>
parents: 14040
diff changeset
556 (cond ((eq vc-follow-symlinks nil)
c9cb9dbb2d40 (vc-follow-symlinks): New variable.
André Spiegel <spiegel@gnu.org>
parents: 14040
diff changeset
557 (message
c9cb9dbb2d40 (vc-follow-symlinks): New variable.
André Spiegel <spiegel@gnu.org>
parents: 14040
diff changeset
558 "Warning: symbolic link to %s-controlled source file" link-type))
15161
ea07411f268e (vc-follow-link, vc-find-file-hook):
Richard M. Stallman <rms@gnu.org>
parents: 14734
diff changeset
559 ((or (not (eq vc-follow-symlinks 'ask))
ea07411f268e (vc-follow-link, vc-find-file-hook):
Richard M. Stallman <rms@gnu.org>
parents: 14734
diff changeset
560 ;; If we already visited this file by following
ea07411f268e (vc-follow-link, vc-find-file-hook):
Richard M. Stallman <rms@gnu.org>
parents: 14734
diff changeset
561 ;; the link, don't ask again if we try to visit
ea07411f268e (vc-follow-link, vc-find-file-hook):
Richard M. Stallman <rms@gnu.org>
parents: 14734
diff changeset
562 ;; it again. GUD does that, and repeated questions
ea07411f268e (vc-follow-link, vc-find-file-hook):
Richard M. Stallman <rms@gnu.org>
parents: 14734
diff changeset
563 ;; are painful.
ea07411f268e (vc-follow-link, vc-find-file-hook):
Richard M. Stallman <rms@gnu.org>
parents: 14734
diff changeset
564 (get-file-buffer
31382
cde9770b21e0 Minor doc fixes.
Gerd Moellmann <gerd@gnu.org>
parents: 27262
diff changeset
565 (abbreviate-file-name
cde9770b21e0 Minor doc fixes.
Gerd Moellmann <gerd@gnu.org>
parents: 27262
diff changeset
566 (file-chase-links buffer-file-name))))
15161
ea07411f268e (vc-follow-link, vc-find-file-hook):
Richard M. Stallman <rms@gnu.org>
parents: 14734
diff changeset
567
ea07411f268e (vc-follow-link, vc-find-file-hook):
Richard M. Stallman <rms@gnu.org>
parents: 14734
diff changeset
568 (vc-follow-link)
ea07411f268e (vc-follow-link, vc-find-file-hook):
Richard M. Stallman <rms@gnu.org>
parents: 14734
diff changeset
569 (message "Followed link to %s" buffer-file-name)
ea07411f268e (vc-follow-link, vc-find-file-hook):
Richard M. Stallman <rms@gnu.org>
parents: 14734
diff changeset
570 (vc-find-file-hook))
ea07411f268e (vc-follow-link, vc-find-file-hook):
Richard M. Stallman <rms@gnu.org>
parents: 14734
diff changeset
571 (t
14142
c9cb9dbb2d40 (vc-follow-symlinks): New variable.
André Spiegel <spiegel@gnu.org>
parents: 14040
diff changeset
572 (if (yes-or-no-p (format
c9cb9dbb2d40 (vc-follow-symlinks): New variable.
André Spiegel <spiegel@gnu.org>
parents: 14040
diff changeset
573 "Symbolic link to %s-controlled source file; follow link? " link-type))
14647
b1a88c3a6912 (vc-follow-link): New function.
André Spiegel <spiegel@gnu.org>
parents: 14622
diff changeset
574 (progn (vc-follow-link)
14142
c9cb9dbb2d40 (vc-follow-symlinks): New variable.
André Spiegel <spiegel@gnu.org>
parents: 14040
diff changeset
575 (message "Followed link to %s" buffer-file-name)
c9cb9dbb2d40 (vc-follow-symlinks): New variable.
André Spiegel <spiegel@gnu.org>
parents: 14040
diff changeset
576 (vc-find-file-hook))
31382
cde9770b21e0 Minor doc fixes.
Gerd Moellmann <gerd@gnu.org>
parents: 27262
diff changeset
577 (message
14142
c9cb9dbb2d40 (vc-follow-symlinks): New variable.
André Spiegel <spiegel@gnu.org>
parents: 14040
diff changeset
578 "Warning: editing through the link bypasses version control")
31382
cde9770b21e0 Minor doc fixes.
Gerd Moellmann <gerd@gnu.org>
parents: 27262
diff changeset
579 )))))))))
904
4a1ac370d57a Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
580
4655
604a401e05a4 (vc-find-file-hook, vc-file-not-found-hook): Use add-hook to install.
Paul Eggert <eggert@twinsun.com>
parents: 4338
diff changeset
581 (add-hook 'find-file-hooks 'vc-find-file-hook)
904
4a1ac370d57a Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
582
4a1ac370d57a Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
583 ;;; more hooks, this time for file-not-found
4a1ac370d57a Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
584 (defun vc-file-not-found-hook ()
31382
cde9770b21e0 Minor doc fixes.
Gerd Moellmann <gerd@gnu.org>
parents: 27262
diff changeset
585 "When file is not found, try to check it out from version control.
cde9770b21e0 Minor doc fixes.
Gerd Moellmann <gerd@gnu.org>
parents: 27262
diff changeset
586 Returns t if checkout was successful, nil otherwise.
cde9770b21e0 Minor doc fixes.
Gerd Moellmann <gerd@gnu.org>
parents: 27262
diff changeset
587 Used in `find-file-not-found-hooks'."
22947
f20bf5cd31d9 (vc-file-not-found-hook): Call vc-file-clearprops.
Richard M. Stallman <rms@gnu.org>
parents: 22112
diff changeset
588 ;; When a file does not exist, ignore cached info about it
f20bf5cd31d9 (vc-file-not-found-hook): Call vc-file-clearprops.
Richard M. Stallman <rms@gnu.org>
parents: 22112
diff changeset
589 ;; from a previous visit.
f20bf5cd31d9 (vc-file-not-found-hook): Call vc-file-clearprops.
Richard M. Stallman <rms@gnu.org>
parents: 22112
diff changeset
590 (vc-file-clearprops buffer-file-name)
31382
cde9770b21e0 Minor doc fixes.
Gerd Moellmann <gerd@gnu.org>
parents: 27262
diff changeset
591 (if (and (vc-backend buffer-file-name)
cde9770b21e0 Minor doc fixes.
Gerd Moellmann <gerd@gnu.org>
parents: 27262
diff changeset
592 (yes-or-no-p
cde9770b21e0 Minor doc fixes.
Gerd Moellmann <gerd@gnu.org>
parents: 27262
diff changeset
593 (format "File %s was lost; check out from version control? "
cde9770b21e0 Minor doc fixes.
Gerd Moellmann <gerd@gnu.org>
parents: 27262
diff changeset
594 (file-name-nondirectory buffer-file-name))))
cde9770b21e0 Minor doc fixes.
Gerd Moellmann <gerd@gnu.org>
parents: 27262
diff changeset
595 (save-excursion
cde9770b21e0 Minor doc fixes.
Gerd Moellmann <gerd@gnu.org>
parents: 27262
diff changeset
596 (require 'vc)
cde9770b21e0 Minor doc fixes.
Gerd Moellmann <gerd@gnu.org>
parents: 27262
diff changeset
597 (setq default-directory (file-name-directory buffer-file-name))
cde9770b21e0 Minor doc fixes.
Gerd Moellmann <gerd@gnu.org>
parents: 27262
diff changeset
598 (not (vc-error-occurred (vc-checkout buffer-file-name))))))
904
4a1ac370d57a Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
599
4655
604a401e05a4 (vc-find-file-hook, vc-file-not-found-hook): Use add-hook to install.
Paul Eggert <eggert@twinsun.com>
parents: 4338
diff changeset
600 (add-hook 'find-file-not-found-hooks 'vc-file-not-found-hook)
904
4a1ac370d57a Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
601
11598
540868154dc9 (vc-buffer-backend): New function.
Richard M. Stallman <rms@gnu.org>
parents: 10176
diff changeset
602 (defun vc-kill-buffer-hook ()
31382
cde9770b21e0 Minor doc fixes.
Gerd Moellmann <gerd@gnu.org>
parents: 27262
diff changeset
603 "Discard VC info about a file when we kill its buffer."
cde9770b21e0 Minor doc fixes.
Gerd Moellmann <gerd@gnu.org>
parents: 27262
diff changeset
604 (if (buffer-file-name)
cde9770b21e0 Minor doc fixes.
Gerd Moellmann <gerd@gnu.org>
parents: 27262
diff changeset
605 (vc-file-clearprops (buffer-file-name))))
11598
540868154dc9 (vc-buffer-backend): New function.
Richard M. Stallman <rms@gnu.org>
parents: 10176
diff changeset
606
31382
cde9770b21e0 Minor doc fixes.
Gerd Moellmann <gerd@gnu.org>
parents: 27262
diff changeset
607 ;; ??? DL: why is this not done?
11598
540868154dc9 (vc-buffer-backend): New function.
Richard M. Stallman <rms@gnu.org>
parents: 10176
diff changeset
608 ;;;(add-hook 'kill-buffer-hook 'vc-kill-buffer-hook)
540868154dc9 (vc-buffer-backend): New function.
Richard M. Stallman <rms@gnu.org>
parents: 10176
diff changeset
609
904
4a1ac370d57a Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
610 ;;; Now arrange for bindings and autoloading of the main package.
2491
5f3061858f47 vc-mode: name change.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 2232
diff changeset
611 ;;; Bindings for this have to go in the global map, as we'll often
5f3061858f47 vc-mode: name change.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 2232
diff changeset
612 ;;; want to call them from random buffers.
904
4a1ac370d57a Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
613
31382
cde9770b21e0 Minor doc fixes.
Gerd Moellmann <gerd@gnu.org>
parents: 27262
diff changeset
614 (autoload 'vc-prefix-map "vc" nil nil 'keymap)
cde9770b21e0 Minor doc fixes.
Gerd Moellmann <gerd@gnu.org>
parents: 27262
diff changeset
615 (define-key global-map "\C-xv" 'vc-prefix-map)
8982
2a81d1c79162 (vc-menu-map): Set up menu items.
Richard M. Stallman <rms@gnu.org>
parents: 7568
diff changeset
616
9869
ae7a27dc719d Only define items in vc-menu-map if it is boundp.
Roland McGrath <roland@gnu.org>
parents: 9826
diff changeset
617 (if (not (boundp 'vc-menu-map))
ae7a27dc719d Only define items in vc-menu-map if it is boundp.
Roland McGrath <roland@gnu.org>
parents: 9826
diff changeset
618 ;; Don't do the menu bindings if menu-bar.el wasn't loaded to defvar
ae7a27dc719d Only define items in vc-menu-map if it is boundp.
Roland McGrath <roland@gnu.org>
parents: 9826
diff changeset
619 ;; vc-menu-map.
ae7a27dc719d Only define items in vc-menu-map if it is boundp.
Roland McGrath <roland@gnu.org>
parents: 9826
diff changeset
620 ()
ae7a27dc719d Only define items in vc-menu-map if it is boundp.
Roland McGrath <roland@gnu.org>
parents: 9826
diff changeset
621 ;;(define-key vc-menu-map [show-files]
ae7a27dc719d Only define items in vc-menu-map if it is boundp.
Roland McGrath <roland@gnu.org>
parents: 9826
diff changeset
622 ;; '("Show Files under VC" . (vc-directory t)))
18403
bb63fa860267 (vc-menu-map): Add bindings for vc-retrieve-snapshot and vc-create-snapshot.
Richard M. Stallman <rms@gnu.org>
parents: 18148
diff changeset
623 (define-key vc-menu-map [vc-retrieve-snapshot]
bb63fa860267 (vc-menu-map): Add bindings for vc-retrieve-snapshot and vc-create-snapshot.
Richard M. Stallman <rms@gnu.org>
parents: 18148
diff changeset
624 '("Retrieve Snapshot" . vc-retrieve-snapshot))
bb63fa860267 (vc-menu-map): Add bindings for vc-retrieve-snapshot and vc-create-snapshot.
Richard M. Stallman <rms@gnu.org>
parents: 18148
diff changeset
625 (define-key vc-menu-map [vc-create-snapshot]
bb63fa860267 (vc-menu-map): Add bindings for vc-retrieve-snapshot and vc-create-snapshot.
Richard M. Stallman <rms@gnu.org>
parents: 18148
diff changeset
626 '("Create Snapshot" . vc-create-snapshot))
23255
6b2b3ceeb3cd (vc-menu-map): Change the vc-directory label. Don't
Dave Love <fx@gnu.org>
parents: 22947
diff changeset
627 (define-key vc-menu-map [vc-directory] '("VC Directory Listing" . vc-directory))
9869
ae7a27dc719d Only define items in vc-menu-map if it is boundp.
Roland McGrath <roland@gnu.org>
parents: 9826
diff changeset
628 (define-key vc-menu-map [separator1] '("----"))
18148
c6e694b6de26 (vc-annotate): Entry "Annotate" added to menu and
Richard M. Stallman <rms@gnu.org>
parents: 17642
diff changeset
629 (define-key vc-menu-map [vc-annotate] '("Annotate" . vc-annotate))
9869
ae7a27dc719d Only define items in vc-menu-map if it is boundp.
Roland McGrath <roland@gnu.org>
parents: 9826
diff changeset
630 (define-key vc-menu-map [vc-rename-file] '("Rename File" . vc-rename-file))
ae7a27dc719d Only define items in vc-menu-map if it is boundp.
Roland McGrath <roland@gnu.org>
parents: 9826
diff changeset
631 (define-key vc-menu-map [vc-version-other-window]
ae7a27dc719d Only define items in vc-menu-map if it is boundp.
Roland McGrath <roland@gnu.org>
parents: 9826
diff changeset
632 '("Show Other Version" . vc-version-other-window))
ae7a27dc719d Only define items in vc-menu-map if it is boundp.
Roland McGrath <roland@gnu.org>
parents: 9826
diff changeset
633 (define-key vc-menu-map [vc-diff] '("Compare with Last Version" . vc-diff))
ae7a27dc719d Only define items in vc-menu-map if it is boundp.
Roland McGrath <roland@gnu.org>
parents: 9826
diff changeset
634 (define-key vc-menu-map [vc-update-change-log]
ae7a27dc719d Only define items in vc-menu-map if it is boundp.
Roland McGrath <roland@gnu.org>
parents: 9826
diff changeset
635 '("Update ChangeLog" . vc-update-change-log))
ae7a27dc719d Only define items in vc-menu-map if it is boundp.
Roland McGrath <roland@gnu.org>
parents: 9826
diff changeset
636 (define-key vc-menu-map [vc-print-log] '("Show History" . vc-print-log))
ae7a27dc719d Only define items in vc-menu-map if it is boundp.
Roland McGrath <roland@gnu.org>
parents: 9826
diff changeset
637 (define-key vc-menu-map [separator2] '("----"))
ae7a27dc719d Only define items in vc-menu-map if it is boundp.
Roland McGrath <roland@gnu.org>
parents: 9826
diff changeset
638 (define-key vc-menu-map [undo] '("Undo Last Check-In" . vc-cancel-version))
ae7a27dc719d Only define items in vc-menu-map if it is boundp.
Roland McGrath <roland@gnu.org>
parents: 9826
diff changeset
639 (define-key vc-menu-map [vc-revert-buffer]
ae7a27dc719d Only define items in vc-menu-map if it is boundp.
Roland McGrath <roland@gnu.org>
parents: 9826
diff changeset
640 '("Revert to Last Version" . vc-revert-buffer))
ae7a27dc719d Only define items in vc-menu-map if it is boundp.
Roland McGrath <roland@gnu.org>
parents: 9826
diff changeset
641 (define-key vc-menu-map [vc-insert-header]
ae7a27dc719d Only define items in vc-menu-map if it is boundp.
Roland McGrath <roland@gnu.org>
parents: 9826
diff changeset
642 '("Insert Header" . vc-insert-headers))
19103
3a841692390c (vc-menu-map): Replace entries for "Check In" and "Check Out" with
André Spiegel <spiegel@gnu.org>
parents: 19054
diff changeset
643 (define-key vc-menu-map [vc-next-action] '("Check In/Out" . vc-next-action))
14622
3d47471d947d Move all the put's for menu-enable props to top level.
Karl Heuer <kwzh@gnu.org>
parents: 14566
diff changeset
644 (define-key vc-menu-map [vc-register] '("Register" . vc-register)))
3d47471d947d Move all the put's for menu-enable props to top level.
Karl Heuer <kwzh@gnu.org>
parents: 14566
diff changeset
645
23255
6b2b3ceeb3cd (vc-menu-map): Change the vc-directory label. Don't
Dave Love <fx@gnu.org>
parents: 22947
diff changeset
646 ;;; These are not correct and it's not currently clear how doing it
6b2b3ceeb3cd (vc-menu-map): Change the vc-directory label. Don't
Dave Love <fx@gnu.org>
parents: 22947
diff changeset
647 ;;; better (with more complicated expressions) might slow things down
6b2b3ceeb3cd (vc-menu-map): Change the vc-directory label. Don't
Dave Love <fx@gnu.org>
parents: 22947
diff changeset
648 ;;; on older systems.
6b2b3ceeb3cd (vc-menu-map): Change the vc-directory label. Don't
Dave Love <fx@gnu.org>
parents: 22947
diff changeset
649
6b2b3ceeb3cd (vc-menu-map): Change the vc-directory label. Don't
Dave Love <fx@gnu.org>
parents: 22947
diff changeset
650 ;;;(put 'vc-rename-file 'menu-enable 'vc-mode)
6b2b3ceeb3cd (vc-menu-map): Change the vc-directory label. Don't
Dave Love <fx@gnu.org>
parents: 22947
diff changeset
651 ;;;(put 'vc-annotate 'menu-enable '(eq (vc-buffer-backend) 'CVS))
6b2b3ceeb3cd (vc-menu-map): Change the vc-directory label. Don't
Dave Love <fx@gnu.org>
parents: 22947
diff changeset
652 ;;;(put 'vc-version-other-window 'menu-enable 'vc-mode)
6b2b3ceeb3cd (vc-menu-map): Change the vc-directory label. Don't
Dave Love <fx@gnu.org>
parents: 22947
diff changeset
653 ;;;(put 'vc-diff 'menu-enable 'vc-mode)
6b2b3ceeb3cd (vc-menu-map): Change the vc-directory label. Don't
Dave Love <fx@gnu.org>
parents: 22947
diff changeset
654 ;;;(put 'vc-update-change-log 'menu-enable
31382
cde9770b21e0 Minor doc fixes.
Gerd Moellmann <gerd@gnu.org>
parents: 27262
diff changeset
655 ;;; '(member (vc-buffer-backend) '(RCS CVS)))
23255
6b2b3ceeb3cd (vc-menu-map): Change the vc-directory label. Don't
Dave Love <fx@gnu.org>
parents: 22947
diff changeset
656 ;;;(put 'vc-print-log 'menu-enable 'vc-mode)
6b2b3ceeb3cd (vc-menu-map): Change the vc-directory label. Don't
Dave Love <fx@gnu.org>
parents: 22947
diff changeset
657 ;;;(put 'vc-cancel-version 'menu-enable 'vc-mode)
6b2b3ceeb3cd (vc-menu-map): Change the vc-directory label. Don't
Dave Love <fx@gnu.org>
parents: 22947
diff changeset
658 ;;;(put 'vc-revert-buffer 'menu-enable 'vc-mode)
6b2b3ceeb3cd (vc-menu-map): Change the vc-directory label. Don't
Dave Love <fx@gnu.org>
parents: 22947
diff changeset
659 ;;;(put 'vc-insert-headers 'menu-enable 'vc-mode)
6b2b3ceeb3cd (vc-menu-map): Change the vc-directory label. Don't
Dave Love <fx@gnu.org>
parents: 22947
diff changeset
660 ;;;(put 'vc-next-action 'menu-enable 'vc-mode)
6b2b3ceeb3cd (vc-menu-map): Change the vc-directory label. Don't
Dave Love <fx@gnu.org>
parents: 22947
diff changeset
661 ;;;(put 'vc-register 'menu-enable '(and buffer-file-name (not vc-mode)))
904
4a1ac370d57a Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
662
4a1ac370d57a Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
663 (provide 'vc-hooks)
4a1ac370d57a Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
664
4a1ac370d57a Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
665 ;;; vc-hooks.el ends here