Mercurial > emacs
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 |
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 | 2 |
31382 | 3 ;; Copyright (C) 1992,93,94,95,96,98,99,2000 Free Software Foundation, Inc. |
904 | 4 |
31382 | 5 ;; Author: FSF (see vc.el for full credits) |
6 ;; Maintainer: Andre Spiegel <spiegel@gnu.org> | |
904 | 7 |
31382 | 8 ;; $Id: vc-hooks.el,v 1.53 2000/08/13 11:36:46 spiegel Exp $ |
20989 | 9 |
904 | 10 ;; This file is part of GNU Emacs. |
11 | |
12 ;; GNU Emacs is free software; you can redistribute it and/or modify | |
13 ;; it under the terms of the GNU General Public License as published by | |
14 ;; the Free Software Foundation; either version 2, or (at your option) | |
15 ;; any later version. | |
16 | |
17 ;; GNU Emacs is distributed in the hope that it will be useful, | |
18 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of | |
19 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
20 ;; GNU General Public License for more details. | |
21 | |
22 ;; You should have received a copy of the GNU General Public License | |
14169 | 23 ;; along with GNU Emacs; see the file COPYING. If not, write to the |
24 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330, | |
25 ;; Boston, MA 02111-1307, USA. | |
904 | 26 |
27 ;;; Commentary: | |
28 | |
31382 | 29 ;; This is the always-loaded portion of VC. It takes care of |
30 ;; VC-related activities that are done when you visit a file, so that | |
31 ;; vc.el itself is loaded only when you use a VC command. See the | |
32 ;; commentary of vc.el. | |
904 | 33 |
34 ;;; Code: | |
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 | 38 (defvar vc-ignore-vc-files nil "Obsolete -- use `vc-handled-backends'.") |
39 (defvar vc-master-templates () "Obsolete -- use vc-BACKEND-master-templates.") | |
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 | 42 (defcustom vc-handled-backends '(RCS CVS SCCS) |
43 "*List of version control backends for which VC will be used. | |
44 Entries in this list will be tried in order to determine whether a | |
45 file is under that sort of version control. | |
46 Removing an entry from the list prevents VC from being activated | |
47 when visiting a file managed by that backend. | |
48 An empty list disables VC altogether." | |
49 :type '(repeat symbol) | |
50 :version "20.5" | |
20413 | 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 | 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 | 57 "*List of extra directories to search for version control commands." |
58 :type '(repeat directory) | |
59 :group 'vc) | |
11604
401afae906eb
(vc-default-backend, vc-path, vc-consult-headers):
Karl Heuer <kwzh@gnu.org>
parents:
11598
diff
changeset
|
60 |
20413 | 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 | 63 If nil (the default), files covered by version control don't get backups." |
64 :type 'boolean | |
65 :group 'vc) | |
904 | 66 |
20413 | 67 (defcustom vc-follow-symlinks 'ask |
31382 | 68 "*What to do if visiting a symbolic link to a file under version control. |
69 Editing such a file through the link bypasses the version control system, | |
70 which is dangerous and probably not what you want. | |
71 | |
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 | 75 visited and a warning displayed." |
31382 | 76 :type '(choice (const :tag "Ask for confirmation" ask) |
77 (const :tag "Visit link and warn" nil) | |
78 (const :tag "Follow link" t)) | |
20413 | 79 :group 'vc) |
14142
c9cb9dbb2d40
(vc-follow-symlinks): New variable.
André Spiegel <spiegel@gnu.org>
parents:
14040
diff
changeset
|
80 |
20413 | 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 | 83 Otherwise, not displayed." |
84 :type 'boolean | |
85 :group 'vc) | |
86 | |
3900
c6f3d2af0df7
(vc-rcs-status): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
3459
diff
changeset
|
87 |
20413 | 88 (defcustom vc-consult-headers t |
89 "*If non-nil, identify work files by searching for version headers." | |
90 :type 'boolean | |
91 :group 'vc) | |
11604
401afae906eb
(vc-default-backend, vc-path, vc-consult-headers):
Karl Heuer <kwzh@gnu.org>
parents:
11598
diff
changeset
|
92 |
20413 | 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 | 96 value of this flag." |
97 :type 'boolean | |
98 :group 'vc) | |
11604
401afae906eb
(vc-default-backend, vc-path, vc-consult-headers):
Karl Heuer <kwzh@gnu.org>
parents:
11598
diff
changeset
|
99 |
20413 | 100 (defcustom vc-mistrust-permissions nil |
31382 | 101 "*If non-nil, don't assume permissions/ownership track version-control status. |
102 If nil, do rely on the permissions. | |
20413 | 103 See also variable `vc-consult-headers'." |
104 :type 'boolean | |
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 | 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 | 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 | 114 ;; Tell Emacs about this new kind of minor mode |
31382 | 115 (add-to-list 'minor-mode-alist '(vc-mode vc-mode)) |
904 | 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 | 119 |
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 | 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 | 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 | 129 (defvar vc-file-prop-obarray (make-vector 16 0) |
904 | 130 "Obarray for per-file properties.") |
131 | |
132 (defun vc-file-setprop (file property value) | |
31382 | 133 "Set per-file VC PROPERTY for FILE to VALUE." |
904 | 134 (put (intern file vc-file-prop-obarray) property value)) |
135 | |
136 (defun vc-file-getprop (file property) | |
31382 | 137 "get per-file VC PROPERTY for FILE." |
904 | 138 (get (intern file vc-file-prop-obarray) property)) |
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 | 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 | 144 |
145 ;; We keep properties on each symbol naming a backend as follows: | |
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 | 148 (defun vc-make-backend-sym (backend sym) |
149 "Return BACKEND-specific version of VC symbol SYM." | |
150 (intern (concat "vc-" (downcase (symbol-name backend)) | |
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 | 153 (defun vc-find-backend-function (backend fun) |
154 "Return BACKEND-specific implementation of FUN. | |
155 If there is no such implementation, return the default implementation; | |
156 if that doesn't exist either, return nil." | |
157 (let ((f (vc-make-backend-sym backend fun))) | |
158 (if (fboundp f) f | |
159 ;; Load vc-BACKEND.el if needed. | |
160 (require (intern (concat "vc-" (downcase (symbol-name backend))))) | |
161 (if (fboundp f) f | |
162 (let ((def (vc-make-backend-sym 'default fun))) | |
163 (if (fboundp def) (cons def backend) nil)))))) | |
164 | |
165 (defun vc-call-backend (backend function-name &rest args) | |
166 "Call for BACKEND the implementation of FUNCTION-NAME with the given ARGS. | |
167 Calls | |
11604
401afae906eb
(vc-default-backend, vc-path, vc-consult-headers):
Karl Heuer <kwzh@gnu.org>
parents:
11598
diff
changeset
|
168 |
31382 | 169 (apply 'vc-BACKEND-FUN ARGS) |
170 | |
171 if vc-BACKEND-FUN exists (after trying to find it in vc-BACKEND.el) | |
172 and else calls | |
173 | |
174 (apply 'vc-default-FUN BACKEND ARGS) | |
175 | |
176 It is usually called via the `vc-call' macro." | |
177 (let ((f (cdr (assoc function-name (get backend 'vc-functions))))) | |
178 (unless f | |
179 (setq f (vc-find-backend-function backend function-name)) | |
180 (put backend 'vc-functions (cons (cons function-name f) | |
181 (get backend 'vc-functions)))) | |
182 (if (consp f) | |
183 (apply (car f) (cdr f) args) | |
184 (apply f args)))) | |
185 | |
186 (defmacro vc-call (fun file &rest args) | |
187 ;; BEWARE!! `file' is evaluated twice!! | |
188 `(vc-call-backend (vc-backend ,file) ',fun ,file ,@args)) | |
189 | |
190 | |
191 (defsubst vc-parse-buffer (pattern i) | |
192 "Find PATTERN in the current buffer and return its Ith submatch." | |
193 (goto-char (point-min)) | |
194 (if (re-search-forward pattern nil t) | |
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 | 198 "Insert the contents of FILE into the current buffer. |
199 | |
200 Optional argument LIMIT is a regexp. If present, the file is inserted | |
201 in chunks of size BLOCKSIZE (default 8 kByte), until the first | |
202 occurrence of LIMIT is found. The function returns nil if FILE doesn't | |
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 | 212 (setq found |
213 (or (zerop (cadr (insert-file-contents | |
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 | 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 | 230 ;;; properties indicating the backend being used for FILE |
231 | |
232 (defun vc-registered (file) | |
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 | 235 This function does not cache its result; it performs the test each |
236 time it is invoked on a file. For a caching check whether a file is | |
237 registered, use `vc-backend'." | |
238 (let (handler) | |
239 (if (boundp 'file-name-handler-alist) | |
240 (setq handler (find-file-name-handler file 'vc-registered))) | |
241 (if handler | |
242 ;; handler should set vc-backend and return t if registered | |
243 (funcall handler 'vc-registered file) | |
244 ;; There is no file name handler. | |
245 ;; Try vc-BACKEND-registered for each handled BACKEND. | |
246 (catch 'found | |
247 (mapcar | |
248 (lambda (b) | |
249 (and (vc-call-backend b 'registered file) | |
250 (vc-file-setprop file 'vc-backend b) | |
251 (throw 'found t))) | |
252 (unless vc-ignore-vc-files | |
253 vc-handled-backends)) | |
254 ;; File is not registered. | |
255 (vc-file-setprop file 'vc-backend 'none) | |
256 nil)))) | |
257 | |
258 (defun vc-backend (file) | |
259 "Return the version control type of FILE, nil if it is not registered." | |
260 ;; `file' can be nil in several places (typically due to the use of | |
261 ;; code like (vc-backend (buffer-file-name))). | |
262 (when (stringp file) | |
263 (let ((property (vc-file-getprop file 'vc-backend))) | |
264 ;; Note that internally, Emacs remembers unregistered | |
265 ;; files by setting the property to `none'. | |
266 (cond ((eq property 'none) nil) | |
267 (property) | |
268 ;; vc-registered sets the vc-backend property | |
269 (t (if (vc-registered file) | |
270 (vc-file-getprop file 'vc-backend) | |
271 nil)))))) | |
272 | |
273 (defun vc-backend-subdirectory-name (file) | |
274 "Return where the master and lock FILEs for the current directory are kept." | |
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 | 278 "Return the master name of FILE. If the file is not registered, or |
279 the master name is not known, return nil." | |
280 ;; TODO: This should ultimately become obsolete, at least up here | |
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 | 286 (defun vc-checkout-model (file) |
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 | 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 | 291 'implicit File is always writeable, and checked out `implicitly' |
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 | 294 'locking File is read-only if up-to-date; user must type |
295 \\[vc-toggle-read-only] before editing. Strict locking | |
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 | 298 'announce File is read-only if up-to-date; user must type |
299 \\[vc-toggle-read-only] before editing. But other users | |
300 may be editing at the same time." | |
301 (or (vc-file-getprop file 'vc-checkout-model) | |
302 (vc-file-setprop file 'vc-checkout-model | |
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 | 306 "Return the name under which the user is logged in, as a string. |
307 \(With optional argument UID, return the name of that user.) | |
308 This function does the same as function `user-login-name', but unlike | |
309 that, it never returns nil. If a UID cannot be resolved, that | |
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 | 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 | 314 (defun vc-state (file) |
315 "Return the version control state of FILE. | |
316 | |
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 | 319 'up-to-date The working file is unmodified with respect to the |
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 | 322 'edited The working file has been edited by the user. If |
323 locking is used for the file, this state means that | |
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 | 326 USER The current version of the working file is locked by |
327 some other USER (a string). | |
328 | |
329 'needs-patch The file has not been edited by the user, but there is | |
330 a more recent version on the current branch stored | |
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 | 333 'needs-merge The file has been edited by the user, and there is also |
334 a more recent version on the current branch stored in | |
335 the master file. This state can only occur if locking | |
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 | 338 'unlocked-changes The current version of the working file is not locked, |
339 but the working file has been changed with respect | |
340 to that version. This state can only occur for files | |
341 with locking; it represents an erroneous condition that | |
342 should be resolved by the user (vc-next-action will | |
343 prompt the user to do it)." | |
344 (or (vc-file-getprop file 'vc-state) | |
345 (vc-file-setprop file 'vc-state | |
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 | 348 (defsubst vc-up-to-date-p (file) |
349 "Convenience function that checks whether `vc-state' of FILE is `up-to-date'." | |
350 (eq (vc-state file) 'up-to-date)) | |
351 | |
352 (defun vc-default-state-heuristic (backend file) | |
353 "Default implementation of vc-state-heuristic. It simply calls the | |
354 real state computation function `vc-BACKEND-state' and does not employ | |
355 any heuristic at all." | |
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 | 359 "Return version level of the current workfile FILE." |
360 (or (vc-file-getprop file 'vc-workfile-version) | |
361 (vc-file-setprop file 'vc-workfile-version | |
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 | 364 ;;; actual version-control code starts here |
365 | |
31382 | 366 (defun vc-default-registered (backend file) |
367 "Check if FILE is registered in BACKEND using vc-BACKEND-master-templates." | |
368 (let ((sym (vc-make-backend-sym backend 'master-templates))) | |
369 (unless (get backend 'vc-templates-grabbed) | |
370 (put backend 'vc-templates-grabbed t) | |
371 (set sym (append (delq nil | |
372 (mapcar | |
373 (lambda (template) | |
374 (and (consp template) | |
375 (eq (cdr template) backend) | |
376 (car template))) | |
377 vc-master-templates)) | |
378 (symbol-value sym)))) | |
379 (let ((result (vc-check-master-templates file (symbol-value sym)))) | |
380 (if (stringp result) | |
381 (vc-file-setprop file 'vc-name result) | |
382 nil)))) ; Not registered | |
904 | 383 |
31382 | 384 (defun vc-possible-master (s dirname basename) |
385 (cond | |
386 ((stringp s) (format s dirname basename)) | |
387 ((functionp s) | |
388 ;; The template is a function to invoke. If the | |
389 ;; function returns non-nil, that means it has found a | |
390 ;; master. For backward compatibility, we also handle | |
391 ;; the case that the function throws a 'found atom | |
392 ;; and a pair (cons MASTER-FILE BACKEND). | |
393 (let ((result (catch 'found (funcall s dirname basename)))) | |
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 | 396 (defun vc-check-master-templates (file templates) |
397 "Return non-nil if there is a master corresponding to FILE, | |
398 according to any of the elements in TEMPLATES. | |
399 | |
400 TEMPLATES is a list of strings or functions. If an element is a | |
401 string, it must be a control string as required by `format', with two | |
402 string placeholders, such as \"%sRCS/%s,v\". The directory part of | |
403 FILE is substituted for the first placeholder, the basename of FILE | |
404 for the second. If a file with the resulting name exists, it is taken | |
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 | 407 If an element of TEMPLATES is a function, it is called with the |
408 directory part and the basename of FILE as arguments. It should | |
409 return non-nil if it finds a master; that value is then returned by | |
410 this function." | |
411 (let ((dirname (or (file-name-directory file) "")) | |
412 (basename (file-name-nondirectory file))) | |
413 (catch 'found | |
414 (mapcar | |
415 (lambda (s) | |
416 (let ((trial (vc-possible-master s dirname basename))) | |
417 (if (and trial (file-exists-p trial) | |
418 ;; Make sure the file we found with name | |
419 ;; TRIAL is not the source file itself. | |
420 ;; That can happen with RCS-style names if | |
421 ;; the file name is truncated (e.g. to 14 | |
422 ;; chars). See if either directory or | |
423 ;; attributes differ. | |
424 (or (not (string= dirname | |
425 (file-name-directory trial))) | |
426 (not (equal (file-attributes file) | |
427 (file-attributes trial))))) | |
428 (throw 'found trial)))) | |
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 | 441 ;; use boundp because vc.el might not be loaded |
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 | 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 | 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 | 448 "Function to be called by `basic-save-buffer' (in files.el)." |
449 ;; If the file in the current buffer is under version control, | |
450 ;; up-to-date, and locking is not used for the file, set | |
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 | 461 (vc-up-to-date-p file) |
462 (eq (vc-checkout-model file) 'implicit) | |
463 (vc-file-setprop file 'vc-state 'edited) | |
464 (vc-mode-line file) | |
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 | 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 | 469 The value is set in the current buffer, which should be the buffer |
31382 | 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 | 472 (unless (not (vc-backend file)) |
473 (setq vc-mode (concat " " | |
474 (if vc-display-status | |
475 (vc-call mode-line-string file) | |
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 | 479 ;; cannot modify a file that someone else has locked. |
31382 | 480 (and (equal file (buffer-file-name)) |
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 | 483 ;; If the user is root, and the file is not owner-writable, |
484 ;; then pretend that we can't write it | |
485 ;; even though we can (because root can write anything). | |
486 ;; This way, even root cannot modify a file that isn't locked. | |
31382 | 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 | 491 (setq buffer-read-only t))) |
492 (force-mode-line-update) | |
493 (vc-backend file)) | |
494 | |
495 (defun vc-default-mode-line-string (backend file) | |
496 "Return string for placement in modeline by `vc-mode-line' for FILE. | |
497 Format: | |
498 | |
499 \"BACKEND-REV\" if the file is up-to-date | |
500 \"BACKEND:REV\" if the file is edited (or locked by the calling user) | |
501 \"BACKEND:LOCKER:REV\" if the file is locked by somebody else | |
502 \"BACKEND @@\" for a CVS file that is added, but not yet committed | |
904 | 503 |
31382 | 504 This function assumes that the file is registered." |
505 (setq backend (symbol-name backend)) | |
506 (let ((state (vc-state file)) | |
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 | 509 ;; CVS special case; should go into a CVS-specific implementation |
510 (concat backend " @@")) | |
511 ((or (eq state 'up-to-date) | |
512 (eq state 'needs-patch)) | |
513 (concat backend "-" rev)) | |
514 ((stringp state) | |
515 (concat backend ":" state ":" rev)) | |
516 (t | |
517 ;; Not just for the 'edited state, but also a fallback | |
518 ;; for all other states. Think about different symbols | |
519 ;; for 'needs-patch and 'needs-merge. | |
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 | 523 "If current buffer visits a symbolic link, visit the real file. |
524 If the real file is already visited in another buffer, make that buffer | |
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 | 539 (defun vc-find-file-hook () |
31382 | 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 | 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 | 565 (abbreviate-file-name |
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 | 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 | 579 ))))))))) |
904 | 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 | 582 |
583 ;;; more hooks, this time for file-not-found | |
584 (defun vc-file-not-found-hook () | |
31382 | 585 "When file is not found, try to check it out from version control. |
586 Returns t if checkout was successful, nil otherwise. | |
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 | 591 (if (and (vc-backend buffer-file-name) |
592 (yes-or-no-p | |
593 (format "File %s was lost; check out from version control? " | |
594 (file-name-nondirectory buffer-file-name)))) | |
595 (save-excursion | |
596 (require 'vc) | |
597 (setq default-directory (file-name-directory buffer-file-name)) | |
598 (not (vc-error-occurred (vc-checkout buffer-file-name)))))) | |
904 | 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 | 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 | 603 "Discard VC info about a file when we kill its buffer." |
604 (if (buffer-file-name) | |
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 | 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 | 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 | 613 |
31382 | 614 (autoload 'vc-prefix-map "vc" nil nil 'keymap) |
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 | 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 | 662 |
663 (provide 'vc-hooks) | |
664 | |
665 ;;; vc-hooks.el ends here |