Mercurial > emacs
annotate lisp/vc-hooks.el @ 9023:1f1081c31047
Initial revision
author | Richard M. Stallman <rms@gnu.org> |
---|---|
date | Fri, 23 Sep 1994 18:35:06 +0000 |
parents | 2a81d1c79162 |
children | 325cee61ab7f |
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 |
7300 | 3 ;; Copyright (C) 1992, 1993, 1994 Free Software Foundation, Inc. |
904 | 4 |
5 ;; Author: Eric S. Raymond <esr@snark.thyrsus.com> | |
2491
5f3061858f47
vc-mode: name change.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2232
diff
changeset
|
6 ;; Version: 5.3 |
904 | 7 |
8 ;; This file is part of GNU Emacs. | |
9 | |
10 ;; GNU Emacs is free software; you can redistribute it and/or modify | |
11 ;; it under the terms of the GNU General Public License as published by | |
12 ;; the Free Software Foundation; either version 2, or (at your option) | |
13 ;; any later version. | |
14 | |
15 ;; GNU Emacs is distributed in the hope that it will be useful, | |
16 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of | |
17 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
18 ;; GNU General Public License for more details. | |
19 | |
20 ;; You should have received a copy of the GNU General Public License | |
21 ;; along with GNU Emacs; see the file COPYING. If not, write to | |
22 ;; the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. | |
23 | |
24 ;;; Commentary: | |
25 | |
26 ;; See the commentary of vc.el. | |
27 | |
28 ;;; Code: | |
29 | |
30 (defvar vc-master-templates | |
31 '(("%sRCS/%s,v" . RCS) ("%s%s,v" . RCS) ("%sRCS/%s" . RCS) | |
32 ("%sSCCS/s.%s" . SCCS) ("%ss.%s". SCCS)) | |
33 "*Where to look for version-control master files. | |
34 The first pair corresponding to a given back end is used as a template | |
35 when creating new masters.") | |
36 | |
37 (defvar vc-make-backup-files nil | |
5164
04d6b9e7782a
(vc-make-backup-files): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents:
4726
diff
changeset
|
38 "*If non-nil, backups of registered files are made as with other files. |
5783
6a97e54241a3
(vc-make-backup-files): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents:
5743
diff
changeset
|
39 If nil (the default), files covered by version control don't get backups.") |
904 | 40 |
8982
2a81d1c79162
(vc-menu-map): Set up menu items.
Richard M. Stallman <rms@gnu.org>
parents:
7568
diff
changeset
|
41 (defvar vc-display-status t |
2a81d1c79162
(vc-menu-map): Set up menu items.
Richard M. Stallman <rms@gnu.org>
parents:
7568
diff
changeset
|
42 "*If non-nil, display revision number and lock status in modeline. |
3900
c6f3d2af0df7
(vc-rcs-status): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
3459
diff
changeset
|
43 Otherwise, not displayed.") |
c6f3d2af0df7
(vc-rcs-status): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
3459
diff
changeset
|
44 |
904 | 45 ;; Tell Emacs about this new kind of minor mode |
2491
5f3061858f47
vc-mode: name change.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2232
diff
changeset
|
46 (if (not (assoc 'vc-mode minor-mode-alist)) |
5f3061858f47
vc-mode: name change.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2232
diff
changeset
|
47 (setq minor-mode-alist (cons '(vc-mode vc-mode) |
904 | 48 minor-mode-alist))) |
49 | |
2491
5f3061858f47
vc-mode: name change.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2232
diff
changeset
|
50 (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
|
51 (put 'vc-mode 'permanent-local t) |
904 | 52 |
53 ;; We need a notion of per-file properties because the version | |
54 ;; control state of a file is expensive to derive --- we don't | |
55 ;; want to recompute it even on every find. | |
56 | |
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
|
57 (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
|
58 (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
|
59 |
904 | 60 (defvar vc-file-prop-obarray [0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0] |
61 "Obarray for per-file properties.") | |
62 | |
63 (defun vc-file-setprop (file property value) | |
64 ;; set per-file property | |
65 (put (intern file vc-file-prop-obarray) property value)) | |
66 | |
67 (defun vc-file-getprop (file property) | |
68 ;; get per-file property | |
69 (get (intern file vc-file-prop-obarray) property)) | |
70 | |
71 ;;; actual version-control code starts here | |
72 | |
73 (defun vc-registered (file) | |
2218
13be90dfef0c
Merge today's change by eric with everybody else's
Paul Eggert <eggert@twinsun.com>
parents:
2213
diff
changeset
|
74 (let (handler handlers) |
13be90dfef0c
Merge today's change by eric with everybody else's
Paul Eggert <eggert@twinsun.com>
parents:
2213
diff
changeset
|
75 (if (boundp 'file-name-handler-alist) |
7483
dfd719c64907
(vc-registered): Use find-file-name-handler.
Richard M. Stallman <rms@gnu.org>
parents:
7300
diff
changeset
|
76 (setq handler (find-file-name-handler file 'vc-registered))) |
2218
13be90dfef0c
Merge today's change by eric with everybody else's
Paul Eggert <eggert@twinsun.com>
parents:
2213
diff
changeset
|
77 (if handler |
13be90dfef0c
Merge today's change by eric with everybody else's
Paul Eggert <eggert@twinsun.com>
parents:
2213
diff
changeset
|
78 (funcall handler 'vc-registered file) |
13be90dfef0c
Merge today's change by eric with everybody else's
Paul Eggert <eggert@twinsun.com>
parents:
2213
diff
changeset
|
79 ;; Search for a master corresponding to the given file |
13be90dfef0c
Merge today's change by eric with everybody else's
Paul Eggert <eggert@twinsun.com>
parents:
2213
diff
changeset
|
80 (let ((dirname (or (file-name-directory file) "")) |
13be90dfef0c
Merge today's change by eric with everybody else's
Paul Eggert <eggert@twinsun.com>
parents:
2213
diff
changeset
|
81 (basename (file-name-nondirectory file))) |
13be90dfef0c
Merge today's change by eric with everybody else's
Paul Eggert <eggert@twinsun.com>
parents:
2213
diff
changeset
|
82 (catch 'found |
13be90dfef0c
Merge today's change by eric with everybody else's
Paul Eggert <eggert@twinsun.com>
parents:
2213
diff
changeset
|
83 (mapcar |
13be90dfef0c
Merge today's change by eric with everybody else's
Paul Eggert <eggert@twinsun.com>
parents:
2213
diff
changeset
|
84 (function (lambda (s) |
13be90dfef0c
Merge today's change by eric with everybody else's
Paul Eggert <eggert@twinsun.com>
parents:
2213
diff
changeset
|
85 (let ((trial (format (car s) dirname basename))) |
13be90dfef0c
Merge today's change by eric with everybody else's
Paul Eggert <eggert@twinsun.com>
parents:
2213
diff
changeset
|
86 (if (and (file-exists-p trial) |
13be90dfef0c
Merge today's change by eric with everybody else's
Paul Eggert <eggert@twinsun.com>
parents:
2213
diff
changeset
|
87 ;; Make sure the file we found with name |
13be90dfef0c
Merge today's change by eric with everybody else's
Paul Eggert <eggert@twinsun.com>
parents:
2213
diff
changeset
|
88 ;; TRIAL is not the source file itself. |
13be90dfef0c
Merge today's change by eric with everybody else's
Paul Eggert <eggert@twinsun.com>
parents:
2213
diff
changeset
|
89 ;; That can happen with RCS-style names |
13be90dfef0c
Merge today's change by eric with everybody else's
Paul Eggert <eggert@twinsun.com>
parents:
2213
diff
changeset
|
90 ;; if the file name is truncated |
13be90dfef0c
Merge today's change by eric with everybody else's
Paul Eggert <eggert@twinsun.com>
parents:
2213
diff
changeset
|
91 ;; (e.g. to 14 chars). See if either |
13be90dfef0c
Merge today's change by eric with everybody else's
Paul Eggert <eggert@twinsun.com>
parents:
2213
diff
changeset
|
92 ;; directory or attributes differ. |
13be90dfef0c
Merge today's change by eric with everybody else's
Paul Eggert <eggert@twinsun.com>
parents:
2213
diff
changeset
|
93 (or (not (string= dirname |
13be90dfef0c
Merge today's change by eric with everybody else's
Paul Eggert <eggert@twinsun.com>
parents:
2213
diff
changeset
|
94 (file-name-directory trial))) |
13be90dfef0c
Merge today's change by eric with everybody else's
Paul Eggert <eggert@twinsun.com>
parents:
2213
diff
changeset
|
95 (not (equal |
13be90dfef0c
Merge today's change by eric with everybody else's
Paul Eggert <eggert@twinsun.com>
parents:
2213
diff
changeset
|
96 (file-attributes file) |
13be90dfef0c
Merge today's change by eric with everybody else's
Paul Eggert <eggert@twinsun.com>
parents:
2213
diff
changeset
|
97 (file-attributes trial))))) |
13be90dfef0c
Merge today's change by eric with everybody else's
Paul Eggert <eggert@twinsun.com>
parents:
2213
diff
changeset
|
98 (throw 'found (cons trial (cdr s))))))) |
13be90dfef0c
Merge today's change by eric with everybody else's
Paul Eggert <eggert@twinsun.com>
parents:
2213
diff
changeset
|
99 vc-master-templates) |
13be90dfef0c
Merge today's change by eric with everybody else's
Paul Eggert <eggert@twinsun.com>
parents:
2213
diff
changeset
|
100 nil))))) |
904 | 101 |
3989
c24f84e2f019
(vc-name): Moved from vc.el; vc-rcs-status now uses it.
Paul Eggert <eggert@twinsun.com>
parents:
3974
diff
changeset
|
102 (defun vc-name (file) |
c24f84e2f019
(vc-name): Moved from vc.el; vc-rcs-status now uses it.
Paul Eggert <eggert@twinsun.com>
parents:
3974
diff
changeset
|
103 "Return the master name of a file, nil if it is not registered." |
c24f84e2f019
(vc-name): Moved from vc.el; vc-rcs-status now uses it.
Paul Eggert <eggert@twinsun.com>
parents:
3974
diff
changeset
|
104 (or (vc-file-getprop file 'vc-name) |
c24f84e2f019
(vc-name): Moved from vc.el; vc-rcs-status now uses it.
Paul Eggert <eggert@twinsun.com>
parents:
3974
diff
changeset
|
105 (let ((name-and-type (vc-registered file))) |
c24f84e2f019
(vc-name): Moved from vc.el; vc-rcs-status now uses it.
Paul Eggert <eggert@twinsun.com>
parents:
3974
diff
changeset
|
106 (if name-and-type |
c24f84e2f019
(vc-name): Moved from vc.el; vc-rcs-status now uses it.
Paul Eggert <eggert@twinsun.com>
parents:
3974
diff
changeset
|
107 (progn |
c24f84e2f019
(vc-name): Moved from vc.el; vc-rcs-status now uses it.
Paul Eggert <eggert@twinsun.com>
parents:
3974
diff
changeset
|
108 (vc-file-setprop file 'vc-backend (cdr name-and-type)) |
c24f84e2f019
(vc-name): Moved from vc.el; vc-rcs-status now uses it.
Paul Eggert <eggert@twinsun.com>
parents:
3974
diff
changeset
|
109 (vc-file-setprop file 'vc-name (car name-and-type))))))) |
c24f84e2f019
(vc-name): Moved from vc.el; vc-rcs-status now uses it.
Paul Eggert <eggert@twinsun.com>
parents:
3974
diff
changeset
|
110 |
904 | 111 (defun vc-backend-deduce (file) |
3989
c24f84e2f019
(vc-name): Moved from vc.el; vc-rcs-status now uses it.
Paul Eggert <eggert@twinsun.com>
parents:
3974
diff
changeset
|
112 "Return the version-control type of a file, nil if it is not registered." |
904 | 113 (and file |
114 (or (vc-file-getprop file 'vc-backend) | |
3989
c24f84e2f019
(vc-name): Moved from vc.el; vc-rcs-status now uses it.
Paul Eggert <eggert@twinsun.com>
parents:
3974
diff
changeset
|
115 (let ((name-and-type (vc-registered file))) |
c24f84e2f019
(vc-name): Moved from vc.el; vc-rcs-status now uses it.
Paul Eggert <eggert@twinsun.com>
parents:
3974
diff
changeset
|
116 (if name-and-type |
c24f84e2f019
(vc-name): Moved from vc.el; vc-rcs-status now uses it.
Paul Eggert <eggert@twinsun.com>
parents:
3974
diff
changeset
|
117 (progn |
c24f84e2f019
(vc-name): Moved from vc.el; vc-rcs-status now uses it.
Paul Eggert <eggert@twinsun.com>
parents:
3974
diff
changeset
|
118 (vc-file-setprop file 'vc-name (car name-and-type)) |
c24f84e2f019
(vc-name): Moved from vc.el; vc-rcs-status now uses it.
Paul Eggert <eggert@twinsun.com>
parents:
3974
diff
changeset
|
119 (vc-file-setprop file 'vc-backend (cdr name-and-type)))))))) |
904 | 120 |
121 (defun vc-toggle-read-only () | |
2620
d26f75fd9f5e
(vc-mode-line): Don't alter key bindings.
Richard M. Stallman <rms@gnu.org>
parents:
2491
diff
changeset
|
122 "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
|
123 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
|
124 then check the file in or out. Otherwise, just change the read-only flag |
d26f75fd9f5e
(vc-mode-line): Don't alter key bindings.
Richard M. Stallman <rms@gnu.org>
parents:
2491
diff
changeset
|
125 of the buffer." |
904 | 126 (interactive) |
127 (if (vc-backend-deduce (buffer-file-name)) | |
128 (vc-next-action nil) | |
129 (toggle-read-only))) | |
2620
d26f75fd9f5e
(vc-mode-line): Don't alter key bindings.
Richard M. Stallman <rms@gnu.org>
parents:
2491
diff
changeset
|
130 (define-key global-map "\C-x\C-q" 'vc-toggle-read-only) |
904 | 131 |
132 (defun vc-mode-line (file &optional label) | |
2491
5f3061858f47
vc-mode: name change.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2232
diff
changeset
|
133 "Set `vc-mode' to display type of version control for FILE. |
904 | 134 The value is set in the current buffer, which should be the buffer |
8982
2a81d1c79162
(vc-menu-map): Set up menu items.
Richard M. Stallman <rms@gnu.org>
parents:
7568
diff
changeset
|
135 visiting FILE. Second optional arg LABEL is put in place of version |
2a81d1c79162
(vc-menu-map): Set up menu items.
Richard M. Stallman <rms@gnu.org>
parents:
7568
diff
changeset
|
136 control system name." |
2218
13be90dfef0c
Merge today's change by eric with everybody else's
Paul Eggert <eggert@twinsun.com>
parents:
2213
diff
changeset
|
137 (interactive (list buffer-file-name nil)) |
7568
83bd6547675c
(vc-mode-line): Do nothing if FILE is nil.
Richard M. Stallman <rms@gnu.org>
parents:
7483
diff
changeset
|
138 (if file |
83bd6547675c
(vc-mode-line): Do nothing if FILE is nil.
Richard M. Stallman <rms@gnu.org>
parents:
7483
diff
changeset
|
139 (let ((vc-type (vc-backend-deduce file))) |
83bd6547675c
(vc-mode-line): Do nothing if FILE is nil.
Richard M. Stallman <rms@gnu.org>
parents:
7483
diff
changeset
|
140 (setq vc-mode |
8982
2a81d1c79162
(vc-menu-map): Set up menu items.
Richard M. Stallman <rms@gnu.org>
parents:
7568
diff
changeset
|
141 (if vc-type |
2a81d1c79162
(vc-menu-map): Set up menu items.
Richard M. Stallman <rms@gnu.org>
parents:
7568
diff
changeset
|
142 (concat " " (or label (symbol-name vc-type)) |
2a81d1c79162
(vc-menu-map): Set up menu items.
Richard M. Stallman <rms@gnu.org>
parents:
7568
diff
changeset
|
143 (if vc-display-status |
2a81d1c79162
(vc-menu-map): Set up menu items.
Richard M. Stallman <rms@gnu.org>
parents:
7568
diff
changeset
|
144 (vc-status file vc-type))))) |
2a81d1c79162
(vc-menu-map): Set up menu items.
Richard M. Stallman <rms@gnu.org>
parents:
7568
diff
changeset
|
145 ;; Even root shouldn't modify a registered file without |
2a81d1c79162
(vc-menu-map): Set up menu items.
Richard M. Stallman <rms@gnu.org>
parents:
7568
diff
changeset
|
146 ;; locking it first. |
7568
83bd6547675c
(vc-mode-line): Do nothing if FILE is nil.
Richard M. Stallman <rms@gnu.org>
parents:
7483
diff
changeset
|
147 (and vc-type |
83bd6547675c
(vc-mode-line): Do nothing if FILE is nil.
Richard M. Stallman <rms@gnu.org>
parents:
7483
diff
changeset
|
148 (not buffer-read-only) |
83bd6547675c
(vc-mode-line): Do nothing if FILE is nil.
Richard M. Stallman <rms@gnu.org>
parents:
7483
diff
changeset
|
149 (zerop (user-uid)) |
83bd6547675c
(vc-mode-line): Do nothing if FILE is nil.
Richard M. Stallman <rms@gnu.org>
parents:
7483
diff
changeset
|
150 (require 'vc) |
83bd6547675c
(vc-mode-line): Do nothing if FILE is nil.
Richard M. Stallman <rms@gnu.org>
parents:
7483
diff
changeset
|
151 (not (string-equal (user-login-name) (vc-locking-user file))) |
83bd6547675c
(vc-mode-line): Do nothing if FILE is nil.
Richard M. Stallman <rms@gnu.org>
parents:
7483
diff
changeset
|
152 (setq buffer-read-only t)) |
83bd6547675c
(vc-mode-line): Do nothing if FILE is nil.
Richard M. Stallman <rms@gnu.org>
parents:
7483
diff
changeset
|
153 (and (null vc-type) |
83bd6547675c
(vc-mode-line): Do nothing if FILE is nil.
Richard M. Stallman <rms@gnu.org>
parents:
7483
diff
changeset
|
154 (file-symlink-p file) |
83bd6547675c
(vc-mode-line): Do nothing if FILE is nil.
Richard M. Stallman <rms@gnu.org>
parents:
7483
diff
changeset
|
155 (let ((link-type (vc-backend-deduce (file-symlink-p file)))) |
83bd6547675c
(vc-mode-line): Do nothing if FILE is nil.
Richard M. Stallman <rms@gnu.org>
parents:
7483
diff
changeset
|
156 (if link-type |
83bd6547675c
(vc-mode-line): Do nothing if FILE is nil.
Richard M. Stallman <rms@gnu.org>
parents:
7483
diff
changeset
|
157 (message "Warning: symbolic link to %s-controlled source file" |
83bd6547675c
(vc-mode-line): Do nothing if FILE is nil.
Richard M. Stallman <rms@gnu.org>
parents:
7483
diff
changeset
|
158 link-type)))) |
83bd6547675c
(vc-mode-line): Do nothing if FILE is nil.
Richard M. Stallman <rms@gnu.org>
parents:
7483
diff
changeset
|
159 (force-mode-line-update) |
83bd6547675c
(vc-mode-line): Do nothing if FILE is nil.
Richard M. Stallman <rms@gnu.org>
parents:
7483
diff
changeset
|
160 ;;(set-buffer-modified-p (buffer-modified-p)) ;;use this if Emacs 18 |
83bd6547675c
(vc-mode-line): Do nothing if FILE is nil.
Richard M. Stallman <rms@gnu.org>
parents:
7483
diff
changeset
|
161 vc-type))) |
904 | 162 |
8982
2a81d1c79162
(vc-menu-map): Set up menu items.
Richard M. Stallman <rms@gnu.org>
parents:
7568
diff
changeset
|
163 (defun vc-status (file vc-type) |
4063
cebb261b0f10
(vc-rcs-status): Include head version number in mode line if there
Paul Eggert <eggert@twinsun.com>
parents:
4024
diff
changeset
|
164 ;; Return string for placement in modeline by `vc-mode-line'. |
8982
2a81d1c79162
(vc-menu-map): Set up menu items.
Richard M. Stallman <rms@gnu.org>
parents:
7568
diff
changeset
|
165 ;; If FILE is not registered, return nil. |
4063
cebb261b0f10
(vc-rcs-status): Include head version number in mode line if there
Paul Eggert <eggert@twinsun.com>
parents:
4024
diff
changeset
|
166 ;; If FILE is registered but not locked, return " REV" if there is a head |
cebb261b0f10
(vc-rcs-status): Include head version number in mode line if there
Paul Eggert <eggert@twinsun.com>
parents:
4024
diff
changeset
|
167 ;; revision and " @@" otherwise. |
cebb261b0f10
(vc-rcs-status): Include head version number in mode line if there
Paul Eggert <eggert@twinsun.com>
parents:
4024
diff
changeset
|
168 ;; If FILE is locked then return all locks in a string of the |
4159
e0bddf2ba112
(vc-rcs-status): Omit "LOCKER:" if you are the locker.
Paul Eggert <eggert@twinsun.com>
parents:
4104
diff
changeset
|
169 ;; form " LOCKER1:REV1 LOCKER2:REV2 ...", where "LOCKERi:" is empty if you |
e0bddf2ba112
(vc-rcs-status): Omit "LOCKER:" if you are the locker.
Paul Eggert <eggert@twinsun.com>
parents:
4104
diff
changeset
|
170 ;; are the locker, and otherwise is the name of the locker followed by ":". |
3900
c6f3d2af0df7
(vc-rcs-status): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
3459
diff
changeset
|
171 |
c6f3d2af0df7
(vc-rcs-status): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
3459
diff
changeset
|
172 ;; Algorithm: |
c6f3d2af0df7
(vc-rcs-status): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
3459
diff
changeset
|
173 |
8982
2a81d1c79162
(vc-menu-map): Set up menu items.
Richard M. Stallman <rms@gnu.org>
parents:
7568
diff
changeset
|
174 ;; Check for master file corresponding to FILE being visited. |
3900
c6f3d2af0df7
(vc-rcs-status): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
3459
diff
changeset
|
175 ;; |
8982
2a81d1c79162
(vc-menu-map): Set up menu items.
Richard M. Stallman <rms@gnu.org>
parents:
7568
diff
changeset
|
176 ;; RCS: Insert the first few characters of the master file into a |
2a81d1c79162
(vc-menu-map): Set up menu items.
Richard M. Stallman <rms@gnu.org>
parents:
7568
diff
changeset
|
177 ;; work buffer. Search work buffer for "locks...;" phrase; if not |
2a81d1c79162
(vc-menu-map): Set up menu items.
Richard M. Stallman <rms@gnu.org>
parents:
7568
diff
changeset
|
178 ;; found, then keep inserting more characters until the phrase is |
2a81d1c79162
(vc-menu-map): Set up menu items.
Richard M. Stallman <rms@gnu.org>
parents:
7568
diff
changeset
|
179 ;; found. Extract the locks, and remove control characters |
3900
c6f3d2af0df7
(vc-rcs-status): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
3459
diff
changeset
|
180 ;; separating them, like newlines; the string " user1:revision1 |
c6f3d2af0df7
(vc-rcs-status): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
3459
diff
changeset
|
181 ;; user2:revision2 ..." is returned. |
8982
2a81d1c79162
(vc-menu-map): Set up menu items.
Richard M. Stallman <rms@gnu.org>
parents:
7568
diff
changeset
|
182 ;; |
2a81d1c79162
(vc-menu-map): Set up menu items.
Richard M. Stallman <rms@gnu.org>
parents:
7568
diff
changeset
|
183 ;; SCCS: Check if the p-file exists. If it does, read it and |
2a81d1c79162
(vc-menu-map): Set up menu items.
Richard M. Stallman <rms@gnu.org>
parents:
7568
diff
changeset
|
184 ;; extract the locks, giving them the right format. Else use prs to |
2a81d1c79162
(vc-menu-map): Set up menu items.
Richard M. Stallman <rms@gnu.org>
parents:
7568
diff
changeset
|
185 ;; find the revision number. |
2a81d1c79162
(vc-menu-map): Set up menu items.
Richard M. Stallman <rms@gnu.org>
parents:
7568
diff
changeset
|
186 |
3900
c6f3d2af0df7
(vc-rcs-status): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
3459
diff
changeset
|
187 ;; Limitations: |
c6f3d2af0df7
(vc-rcs-status): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
3459
diff
changeset
|
188 |
c6f3d2af0df7
(vc-rcs-status): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
3459
diff
changeset
|
189 ;; The output doesn't show which version you are actually looking at. |
c6f3d2af0df7
(vc-rcs-status): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
3459
diff
changeset
|
190 ;; The modeline can get quite cluttered when there are multiple locks. |
4063
cebb261b0f10
(vc-rcs-status): Include head version number in mode line if there
Paul Eggert <eggert@twinsun.com>
parents:
4024
diff
changeset
|
191 ;; The head revision is probably not what you want if you've used `rcs -b'. |
3900
c6f3d2af0df7
(vc-rcs-status): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
3459
diff
changeset
|
192 |
3989
c24f84e2f019
(vc-name): Moved from vc.el; vc-rcs-status now uses it.
Paul Eggert <eggert@twinsun.com>
parents:
3974
diff
changeset
|
193 (let ((master (vc-name file)) |
8982
2a81d1c79162
(vc-menu-map): Set up menu items.
Richard M. Stallman <rms@gnu.org>
parents:
7568
diff
changeset
|
194 found |
2a81d1c79162
(vc-menu-map): Set up menu items.
Richard M. Stallman <rms@gnu.org>
parents:
7568
diff
changeset
|
195 status) |
3900
c6f3d2af0df7
(vc-rcs-status): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
3459
diff
changeset
|
196 |
8982
2a81d1c79162
(vc-menu-map): Set up menu items.
Richard M. Stallman <rms@gnu.org>
parents:
7568
diff
changeset
|
197 ;; If master file exists, then parse its contents, otherwise we |
2a81d1c79162
(vc-menu-map): Set up menu items.
Richard M. Stallman <rms@gnu.org>
parents:
7568
diff
changeset
|
198 ;; return the nil value of this if form. |
2a81d1c79162
(vc-menu-map): Set up menu items.
Richard M. Stallman <rms@gnu.org>
parents:
7568
diff
changeset
|
199 (if (and master vc-type) |
3900
c6f3d2af0df7
(vc-rcs-status): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
3459
diff
changeset
|
200 (save-excursion |
c6f3d2af0df7
(vc-rcs-status): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
3459
diff
changeset
|
201 |
c6f3d2af0df7
(vc-rcs-status): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
3459
diff
changeset
|
202 ;; Create work buffer. |
8982
2a81d1c79162
(vc-menu-map): Set up menu items.
Richard M. Stallman <rms@gnu.org>
parents:
7568
diff
changeset
|
203 (set-buffer (get-buffer-create " *vc-status*")) |
3900
c6f3d2af0df7
(vc-rcs-status): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
3459
diff
changeset
|
204 (setq buffer-read-only nil |
c6f3d2af0df7
(vc-rcs-status): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
3459
diff
changeset
|
205 default-directory (file-name-directory master)) |
c6f3d2af0df7
(vc-rcs-status): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
3459
diff
changeset
|
206 (erase-buffer) |
c6f3d2af0df7
(vc-rcs-status): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
3459
diff
changeset
|
207 |
8982
2a81d1c79162
(vc-menu-map): Set up menu items.
Richard M. Stallman <rms@gnu.org>
parents:
7568
diff
changeset
|
208 ;; Set the `status' var to the return value. |
2a81d1c79162
(vc-menu-map): Set up menu items.
Richard M. Stallman <rms@gnu.org>
parents:
7568
diff
changeset
|
209 (cond |
2a81d1c79162
(vc-menu-map): Set up menu items.
Richard M. Stallman <rms@gnu.org>
parents:
7568
diff
changeset
|
210 |
2a81d1c79162
(vc-menu-map): Set up menu items.
Richard M. Stallman <rms@gnu.org>
parents:
7568
diff
changeset
|
211 ;; RCS code. |
2a81d1c79162
(vc-menu-map): Set up menu items.
Richard M. Stallman <rms@gnu.org>
parents:
7568
diff
changeset
|
212 ((eq vc-type 'RCS) |
2a81d1c79162
(vc-menu-map): Set up menu items.
Richard M. Stallman <rms@gnu.org>
parents:
7568
diff
changeset
|
213 ;; Check if we have enough of the header. |
2a81d1c79162
(vc-menu-map): Set up menu items.
Richard M. Stallman <rms@gnu.org>
parents:
7568
diff
changeset
|
214 ;; If not, then keep including more. |
2a81d1c79162
(vc-menu-map): Set up menu items.
Richard M. Stallman <rms@gnu.org>
parents:
7568
diff
changeset
|
215 (while |
2a81d1c79162
(vc-menu-map): Set up menu items.
Richard M. Stallman <rms@gnu.org>
parents:
7568
diff
changeset
|
216 (not (or found |
2a81d1c79162
(vc-menu-map): Set up menu items.
Richard M. Stallman <rms@gnu.org>
parents:
7568
diff
changeset
|
217 (let ((s (buffer-size))) |
2a81d1c79162
(vc-menu-map): Set up menu items.
Richard M. Stallman <rms@gnu.org>
parents:
7568
diff
changeset
|
218 (goto-char (1+ s)) |
2a81d1c79162
(vc-menu-map): Set up menu items.
Richard M. Stallman <rms@gnu.org>
parents:
7568
diff
changeset
|
219 (zerop (car (cdr (insert-file-contents |
2a81d1c79162
(vc-menu-map): Set up menu items.
Richard M. Stallman <rms@gnu.org>
parents:
7568
diff
changeset
|
220 master nil s (+ s 8192)))))))) |
2a81d1c79162
(vc-menu-map): Set up menu items.
Richard M. Stallman <rms@gnu.org>
parents:
7568
diff
changeset
|
221 (beginning-of-line) |
2a81d1c79162
(vc-menu-map): Set up menu items.
Richard M. Stallman <rms@gnu.org>
parents:
7568
diff
changeset
|
222 (setq found (re-search-forward "^locks\\([^;]*\\);" nil t))) |
3900
c6f3d2af0df7
(vc-rcs-status): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
3459
diff
changeset
|
223 |
8982
2a81d1c79162
(vc-menu-map): Set up menu items.
Richard M. Stallman <rms@gnu.org>
parents:
7568
diff
changeset
|
224 (if found |
2a81d1c79162
(vc-menu-map): Set up menu items.
Richard M. Stallman <rms@gnu.org>
parents:
7568
diff
changeset
|
225 ;; Clean control characters and self-locks from text. |
2a81d1c79162
(vc-menu-map): Set up menu items.
Richard M. Stallman <rms@gnu.org>
parents:
7568
diff
changeset
|
226 (let* ((lock-pattern |
2a81d1c79162
(vc-menu-map): Set up menu items.
Richard M. Stallman <rms@gnu.org>
parents:
7568
diff
changeset
|
227 (concat "[ \b\t\n\v\f\r]+\\(" |
2a81d1c79162
(vc-menu-map): Set up menu items.
Richard M. Stallman <rms@gnu.org>
parents:
7568
diff
changeset
|
228 (regexp-quote (user-login-name)) |
2a81d1c79162
(vc-menu-map): Set up menu items.
Richard M. Stallman <rms@gnu.org>
parents:
7568
diff
changeset
|
229 ":\\)?")) |
2a81d1c79162
(vc-menu-map): Set up menu items.
Richard M. Stallman <rms@gnu.org>
parents:
7568
diff
changeset
|
230 (locks |
2a81d1c79162
(vc-menu-map): Set up menu items.
Richard M. Stallman <rms@gnu.org>
parents:
7568
diff
changeset
|
231 (save-restriction |
2a81d1c79162
(vc-menu-map): Set up menu items.
Richard M. Stallman <rms@gnu.org>
parents:
7568
diff
changeset
|
232 (narrow-to-region (match-beginning 1) (match-end 1)) |
2a81d1c79162
(vc-menu-map): Set up menu items.
Richard M. Stallman <rms@gnu.org>
parents:
7568
diff
changeset
|
233 (goto-char (point-min)) |
2a81d1c79162
(vc-menu-map): Set up menu items.
Richard M. Stallman <rms@gnu.org>
parents:
7568
diff
changeset
|
234 (while (re-search-forward lock-pattern nil t) |
2a81d1c79162
(vc-menu-map): Set up menu items.
Richard M. Stallman <rms@gnu.org>
parents:
7568
diff
changeset
|
235 (replace-match (if (eobp) "" ":") t t)) |
2a81d1c79162
(vc-menu-map): Set up menu items.
Richard M. Stallman <rms@gnu.org>
parents:
7568
diff
changeset
|
236 (buffer-string)))) |
2a81d1c79162
(vc-menu-map): Set up menu items.
Richard M. Stallman <rms@gnu.org>
parents:
7568
diff
changeset
|
237 (setq status |
2a81d1c79162
(vc-menu-map): Set up menu items.
Richard M. Stallman <rms@gnu.org>
parents:
7568
diff
changeset
|
238 (if (not (string-equal locks "")) |
2a81d1c79162
(vc-menu-map): Set up menu items.
Richard M. Stallman <rms@gnu.org>
parents:
7568
diff
changeset
|
239 locks |
2a81d1c79162
(vc-menu-map): Set up menu items.
Richard M. Stallman <rms@gnu.org>
parents:
7568
diff
changeset
|
240 (goto-char (point-min)) |
2a81d1c79162
(vc-menu-map): Set up menu items.
Richard M. Stallman <rms@gnu.org>
parents:
7568
diff
changeset
|
241 (if (looking-at "head[ \b\t\n\v\f\r]+\\([.0-9]+\\)") |
2a81d1c79162
(vc-menu-map): Set up menu items.
Richard M. Stallman <rms@gnu.org>
parents:
7568
diff
changeset
|
242 (concat "-" |
2a81d1c79162
(vc-menu-map): Set up menu items.
Richard M. Stallman <rms@gnu.org>
parents:
7568
diff
changeset
|
243 (buffer-substring (match-beginning 1) |
2a81d1c79162
(vc-menu-map): Set up menu items.
Richard M. Stallman <rms@gnu.org>
parents:
7568
diff
changeset
|
244 (match-end 1))) |
2a81d1c79162
(vc-menu-map): Set up menu items.
Richard M. Stallman <rms@gnu.org>
parents:
7568
diff
changeset
|
245 " @@")))))) |
2a81d1c79162
(vc-menu-map): Set up menu items.
Richard M. Stallman <rms@gnu.org>
parents:
7568
diff
changeset
|
246 |
2a81d1c79162
(vc-menu-map): Set up menu items.
Richard M. Stallman <rms@gnu.org>
parents:
7568
diff
changeset
|
247 ;; SCCS code. |
2a81d1c79162
(vc-menu-map): Set up menu items.
Richard M. Stallman <rms@gnu.org>
parents:
7568
diff
changeset
|
248 ((eq vc-type 'SCCS) |
2a81d1c79162
(vc-menu-map): Set up menu items.
Richard M. Stallman <rms@gnu.org>
parents:
7568
diff
changeset
|
249 ;; Build the name of the p-file and put it in the work buffer. |
2a81d1c79162
(vc-menu-map): Set up menu items.
Richard M. Stallman <rms@gnu.org>
parents:
7568
diff
changeset
|
250 (insert master) |
2a81d1c79162
(vc-menu-map): Set up menu items.
Richard M. Stallman <rms@gnu.org>
parents:
7568
diff
changeset
|
251 (search-backward "/s.") |
2a81d1c79162
(vc-menu-map): Set up menu items.
Richard M. Stallman <rms@gnu.org>
parents:
7568
diff
changeset
|
252 (delete-char 2) |
2a81d1c79162
(vc-menu-map): Set up menu items.
Richard M. Stallman <rms@gnu.org>
parents:
7568
diff
changeset
|
253 (insert "/p") |
2a81d1c79162
(vc-menu-map): Set up menu items.
Richard M. Stallman <rms@gnu.org>
parents:
7568
diff
changeset
|
254 (if (not (file-exists-p (buffer-string))) |
2a81d1c79162
(vc-menu-map): Set up menu items.
Richard M. Stallman <rms@gnu.org>
parents:
7568
diff
changeset
|
255 ;; No lock. |
2a81d1c79162
(vc-menu-map): Set up menu items.
Richard M. Stallman <rms@gnu.org>
parents:
7568
diff
changeset
|
256 (let ((exec-path (if vc-path (append exec-path vc-path) |
2a81d1c79162
(vc-menu-map): Set up menu items.
Richard M. Stallman <rms@gnu.org>
parents:
7568
diff
changeset
|
257 exec-path))) |
2a81d1c79162
(vc-menu-map): Set up menu items.
Richard M. Stallman <rms@gnu.org>
parents:
7568
diff
changeset
|
258 (erase-buffer) |
2a81d1c79162
(vc-menu-map): Set up menu items.
Richard M. Stallman <rms@gnu.org>
parents:
7568
diff
changeset
|
259 (insert "-") |
2a81d1c79162
(vc-menu-map): Set up menu items.
Richard M. Stallman <rms@gnu.org>
parents:
7568
diff
changeset
|
260 (if (zerop (call-process "prs" nil t nil "-d:I:" master)) |
2a81d1c79162
(vc-menu-map): Set up menu items.
Richard M. Stallman <rms@gnu.org>
parents:
7568
diff
changeset
|
261 (setq status (buffer-substring 1 (1- (point-max)))))) |
2a81d1c79162
(vc-menu-map): Set up menu items.
Richard M. Stallman <rms@gnu.org>
parents:
7568
diff
changeset
|
262 ;; Locks exist. |
2a81d1c79162
(vc-menu-map): Set up menu items.
Richard M. Stallman <rms@gnu.org>
parents:
7568
diff
changeset
|
263 (insert-file-contents (buffer-string) nil nil nil t) |
2a81d1c79162
(vc-menu-map): Set up menu items.
Richard M. Stallman <rms@gnu.org>
parents:
7568
diff
changeset
|
264 (while (looking-at "[^ ]+ \\([^ ]+\\) \\([^ ]+\\).*\n") |
2a81d1c79162
(vc-menu-map): Set up menu items.
Richard M. Stallman <rms@gnu.org>
parents:
7568
diff
changeset
|
265 (replace-match " \\2:\\1")) |
2a81d1c79162
(vc-menu-map): Set up menu items.
Richard M. Stallman <rms@gnu.org>
parents:
7568
diff
changeset
|
266 (setq status (buffer-string)) |
2a81d1c79162
(vc-menu-map): Set up menu items.
Richard M. Stallman <rms@gnu.org>
parents:
7568
diff
changeset
|
267 (aset status 0 ?:)))) |
2a81d1c79162
(vc-menu-map): Set up menu items.
Richard M. Stallman <rms@gnu.org>
parents:
7568
diff
changeset
|
268 |
2a81d1c79162
(vc-menu-map): Set up menu items.
Richard M. Stallman <rms@gnu.org>
parents:
7568
diff
changeset
|
269 ;; Clean work buffer. |
2a81d1c79162
(vc-menu-map): Set up menu items.
Richard M. Stallman <rms@gnu.org>
parents:
7568
diff
changeset
|
270 (erase-buffer) |
2a81d1c79162
(vc-menu-map): Set up menu items.
Richard M. Stallman <rms@gnu.org>
parents:
7568
diff
changeset
|
271 (set-buffer-modified-p nil) |
2a81d1c79162
(vc-menu-map): Set up menu items.
Richard M. Stallman <rms@gnu.org>
parents:
7568
diff
changeset
|
272 status)))) |
3900
c6f3d2af0df7
(vc-rcs-status): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
3459
diff
changeset
|
273 |
904 | 274 ;;; install a call to the above as a find-file hook |
275 (defun vc-find-file-hook () | |
2218
13be90dfef0c
Merge today's change by eric with everybody else's
Paul Eggert <eggert@twinsun.com>
parents:
2213
diff
changeset
|
276 ;; 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
|
277 ;; if user has killed the buffer and revisited. |
3459
763bc1ba714e
(vc-find-file-hook): Check buffer-file-name is non-nil.
Richard M. Stallman <rms@gnu.org>
parents:
2620
diff
changeset
|
278 (if buffer-file-name |
763bc1ba714e
(vc-find-file-hook): Check buffer-file-name is non-nil.
Richard M. Stallman <rms@gnu.org>
parents:
2620
diff
changeset
|
279 (vc-file-setprop buffer-file-name 'vc-backend nil)) |
904 | 280 (if (and (vc-mode-line buffer-file-name) (not vc-make-backup-files)) |
281 (progn | |
6545
3715d5bfad50
(vc-find-file-hook): Set backup-inhibited.
Richard M. Stallman <rms@gnu.org>
parents:
5783
diff
changeset
|
282 ;; Use this variable, not make-backup-files, |
3715d5bfad50
(vc-find-file-hook): Set backup-inhibited.
Richard M. Stallman <rms@gnu.org>
parents:
5783
diff
changeset
|
283 ;; because this is for things that depend on the file name. |
3715d5bfad50
(vc-find-file-hook): Set backup-inhibited.
Richard M. Stallman <rms@gnu.org>
parents:
5783
diff
changeset
|
284 (make-local-variable 'backup-inhibited) |
3715d5bfad50
(vc-find-file-hook): Set backup-inhibited.
Richard M. Stallman <rms@gnu.org>
parents:
5783
diff
changeset
|
285 (setq backup-inhibited t)))) |
904 | 286 |
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
|
287 (add-hook 'find-file-hooks 'vc-find-file-hook) |
904 | 288 |
289 ;;; more hooks, this time for file-not-found | |
290 (defun vc-file-not-found-hook () | |
291 "When file is not found, try to check it out from RCS or SCCS. | |
292 Returns t if checkout was successful, nil otherwise." | |
293 (if (vc-backend-deduce buffer-file-name) | |
8982
2a81d1c79162
(vc-menu-map): Set up menu items.
Richard M. Stallman <rms@gnu.org>
parents:
7568
diff
changeset
|
294 (save-excursion |
904 | 295 (require 'vc) |
296 (not (vc-error-occurred (vc-checkout buffer-file-name)))))) | |
297 | |
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
|
298 (add-hook 'find-file-not-found-hooks 'vc-file-not-found-hook) |
904 | 299 |
300 ;;; 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
|
301 ;;; 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
|
302 ;;; want to call them from random buffers. |
904 | 303 |
304 (setq vc-prefix-map (lookup-key global-map "\C-xv")) | |
305 (if (not (keymapp vc-prefix-map)) | |
306 (progn | |
307 (setq vc-prefix-map (make-sparse-keymap)) | |
308 (define-key global-map "\C-xv" vc-prefix-map) | |
309 (define-key vc-prefix-map "a" 'vc-update-change-log) | |
310 (define-key vc-prefix-map "c" 'vc-cancel-version) | |
2218
13be90dfef0c
Merge today's change by eric with everybody else's
Paul Eggert <eggert@twinsun.com>
parents:
2213
diff
changeset
|
311 (define-key vc-prefix-map "d" 'vc-directory) |
904 | 312 (define-key vc-prefix-map "h" 'vc-insert-headers) |
313 (define-key vc-prefix-map "i" 'vc-register) | |
314 (define-key vc-prefix-map "l" 'vc-print-log) | |
315 (define-key vc-prefix-map "r" 'vc-retrieve-snapshot) | |
316 (define-key vc-prefix-map "s" 'vc-create-snapshot) | |
317 (define-key vc-prefix-map "u" 'vc-revert-buffer) | |
318 (define-key vc-prefix-map "v" 'vc-next-action) | |
2218
13be90dfef0c
Merge today's change by eric with everybody else's
Paul Eggert <eggert@twinsun.com>
parents:
2213
diff
changeset
|
319 (define-key vc-prefix-map "=" 'vc-diff) |
8982
2a81d1c79162
(vc-menu-map): Set up menu items.
Richard M. Stallman <rms@gnu.org>
parents:
7568
diff
changeset
|
320 (define-key vc-prefix-map "~" 'vc-version-other-window))) |
2a81d1c79162
(vc-menu-map): Set up menu items.
Richard M. Stallman <rms@gnu.org>
parents:
7568
diff
changeset
|
321 |
2a81d1c79162
(vc-menu-map): Set up menu items.
Richard M. Stallman <rms@gnu.org>
parents:
7568
diff
changeset
|
322 ;;;(define-key vc-menu-map [show-files] |
2a81d1c79162
(vc-menu-map): Set up menu items.
Richard M. Stallman <rms@gnu.org>
parents:
7568
diff
changeset
|
323 ;;; '("Show Files under VC" . (vc-directory t))) |
2a81d1c79162
(vc-menu-map): Set up menu items.
Richard M. Stallman <rms@gnu.org>
parents:
7568
diff
changeset
|
324 (define-key vc-menu-map [vc-directory] '("Show Locked Files" . vc-directory)) |
2a81d1c79162
(vc-menu-map): Set up menu items.
Richard M. Stallman <rms@gnu.org>
parents:
7568
diff
changeset
|
325 (define-key vc-menu-map [separator1] '("----")) |
2a81d1c79162
(vc-menu-map): Set up menu items.
Richard M. Stallman <rms@gnu.org>
parents:
7568
diff
changeset
|
326 (define-key vc-menu-map [vc-rename-file] '("Rename File" . vc-rename-file)) |
2a81d1c79162
(vc-menu-map): Set up menu items.
Richard M. Stallman <rms@gnu.org>
parents:
7568
diff
changeset
|
327 (define-key vc-menu-map [vc-version-other-window] |
2a81d1c79162
(vc-menu-map): Set up menu items.
Richard M. Stallman <rms@gnu.org>
parents:
7568
diff
changeset
|
328 '("Show Other Version" . vc-version-other-window)) |
2a81d1c79162
(vc-menu-map): Set up menu items.
Richard M. Stallman <rms@gnu.org>
parents:
7568
diff
changeset
|
329 (define-key vc-menu-map [vc-diff] '("Compare with Last Version" . vc-diff)) |
2a81d1c79162
(vc-menu-map): Set up menu items.
Richard M. Stallman <rms@gnu.org>
parents:
7568
diff
changeset
|
330 (define-key vc-menu-map [vc-update-change-log] |
2a81d1c79162
(vc-menu-map): Set up menu items.
Richard M. Stallman <rms@gnu.org>
parents:
7568
diff
changeset
|
331 '("Update ChangeLog" . vc-update-change-log)) |
2a81d1c79162
(vc-menu-map): Set up menu items.
Richard M. Stallman <rms@gnu.org>
parents:
7568
diff
changeset
|
332 (define-key vc-menu-map [vc-print-log] '("Show History" . vc-print-log)) |
2a81d1c79162
(vc-menu-map): Set up menu items.
Richard M. Stallman <rms@gnu.org>
parents:
7568
diff
changeset
|
333 (define-key vc-menu-map [separator2] '("----")) |
2a81d1c79162
(vc-menu-map): Set up menu items.
Richard M. Stallman <rms@gnu.org>
parents:
7568
diff
changeset
|
334 (define-key vc-menu-map [undo] '("Undo Last Check-In" . vc-cancel-version)) |
2a81d1c79162
(vc-menu-map): Set up menu items.
Richard M. Stallman <rms@gnu.org>
parents:
7568
diff
changeset
|
335 (define-key vc-menu-map [vc-revert-buffer] |
2a81d1c79162
(vc-menu-map): Set up menu items.
Richard M. Stallman <rms@gnu.org>
parents:
7568
diff
changeset
|
336 '("Revert to Last Version" . vc-revert-buffer)) |
2a81d1c79162
(vc-menu-map): Set up menu items.
Richard M. Stallman <rms@gnu.org>
parents:
7568
diff
changeset
|
337 (define-key vc-menu-map [vc-insert-header] |
2a81d1c79162
(vc-menu-map): Set up menu items.
Richard M. Stallman <rms@gnu.org>
parents:
7568
diff
changeset
|
338 '("Insert Header" . vc-insert-headers)) |
2a81d1c79162
(vc-menu-map): Set up menu items.
Richard M. Stallman <rms@gnu.org>
parents:
7568
diff
changeset
|
339 (define-key vc-menu-map [vc-menu-check-in] '("Check In" . vc-next-action)) |
2a81d1c79162
(vc-menu-map): Set up menu items.
Richard M. Stallman <rms@gnu.org>
parents:
7568
diff
changeset
|
340 (define-key vc-menu-map [vc-check-out] '("Check Out" . vc-toggle-read-only)) |
2a81d1c79162
(vc-menu-map): Set up menu items.
Richard M. Stallman <rms@gnu.org>
parents:
7568
diff
changeset
|
341 (define-key vc-menu-map [vc-register] '("Register" . vc-register)) |
2a81d1c79162
(vc-menu-map): Set up menu items.
Richard M. Stallman <rms@gnu.org>
parents:
7568
diff
changeset
|
342 |
2a81d1c79162
(vc-menu-map): Set up menu items.
Richard M. Stallman <rms@gnu.org>
parents:
7568
diff
changeset
|
343 (put 'vc-rename-file 'menu-enable 'vc-mode) |
2a81d1c79162
(vc-menu-map): Set up menu items.
Richard M. Stallman <rms@gnu.org>
parents:
7568
diff
changeset
|
344 (put 'vc-version-other-window 'menu-enable 'vc-mode) |
2a81d1c79162
(vc-menu-map): Set up menu items.
Richard M. Stallman <rms@gnu.org>
parents:
7568
diff
changeset
|
345 (put 'vc-diff 'menu-enable 'vc-mode) |
2a81d1c79162
(vc-menu-map): Set up menu items.
Richard M. Stallman <rms@gnu.org>
parents:
7568
diff
changeset
|
346 (put 'vc-update-change-log 'menu-enable '(eq (vc-backend-deduce (buffer-file-name)) 'RCS)) |
2a81d1c79162
(vc-menu-map): Set up menu items.
Richard M. Stallman <rms@gnu.org>
parents:
7568
diff
changeset
|
347 (put 'vc-print-log 'menu-enable 'vc-mode) |
2a81d1c79162
(vc-menu-map): Set up menu items.
Richard M. Stallman <rms@gnu.org>
parents:
7568
diff
changeset
|
348 (put 'vc-cancel-version 'menu-enable 'vc-mode) |
2a81d1c79162
(vc-menu-map): Set up menu items.
Richard M. Stallman <rms@gnu.org>
parents:
7568
diff
changeset
|
349 (put 'vc-revert-buffer 'menu-enable 'vc-mode) |
2a81d1c79162
(vc-menu-map): Set up menu items.
Richard M. Stallman <rms@gnu.org>
parents:
7568
diff
changeset
|
350 (put 'vc-insert-headers 'menu-enable 'vc-mode) |
2a81d1c79162
(vc-menu-map): Set up menu items.
Richard M. Stallman <rms@gnu.org>
parents:
7568
diff
changeset
|
351 (put 'vc-next-action 'menu-enable '(and vc-mode (not buffer-read-only))) |
2a81d1c79162
(vc-menu-map): Set up menu items.
Richard M. Stallman <rms@gnu.org>
parents:
7568
diff
changeset
|
352 (put 'vc-toggle-read-only 'menu-enable '(and vc-mode buffer-read-only)) |
2a81d1c79162
(vc-menu-map): Set up menu items.
Richard M. Stallman <rms@gnu.org>
parents:
7568
diff
changeset
|
353 (put 'vc-register 'menu-enable '(not vc-mode)) |
904 | 354 |
355 (provide 'vc-hooks) | |
356 | |
357 ;;; vc-hooks.el ends here |