annotate lisp/vc-hooks.el @ 986:83605f96f58e

* dispnew.c (the_only_frame): Doc fix.
author Jim Blandy <jimb@redhat.com>
date Fri, 14 Aug 1992 02:31:04 +0000
parents faa1d84dfe50
children 981b00f8fe77
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
904
4a1ac370d57a Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1 ;;; vc-hooks.el -- resident support for version-control
4a1ac370d57a Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
2
4a1ac370d57a Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
3 ;; Copyright (C) 1992 Free Software Foundation, Inc.
4a1ac370d57a Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
4
4a1ac370d57a Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
5 ;; Author: Eric S. Raymond <esr@snark.thyrsus.com>
4a1ac370d57a Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
6 ;; Version: 4.0
4a1ac370d57a Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
7
4a1ac370d57a Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
8 ;; $Id: vc-hooks.el,v 1.44 1992/07/31 06:43:05 esr Exp $
4a1ac370d57a Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
9
4a1ac370d57a Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
10 ;; This file is part of GNU Emacs.
4a1ac370d57a Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
11
4a1ac370d57a Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
12 ;; GNU Emacs is free software; you can redistribute it and/or modify
4a1ac370d57a Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
13 ;; it under the terms of the GNU General Public License as published by
4a1ac370d57a Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
14 ;; the Free Software Foundation; either version 2, or (at your option)
4a1ac370d57a Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
15 ;; any later version.
4a1ac370d57a Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
16
4a1ac370d57a Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
17 ;; GNU Emacs is distributed in the hope that it will be useful,
4a1ac370d57a Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
18 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
4a1ac370d57a Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
19 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
4a1ac370d57a Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
20 ;; GNU General Public License for more details.
4a1ac370d57a Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
21
4a1ac370d57a Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
22 ;; You should have received a copy of the GNU General Public License
4a1ac370d57a Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
23 ;; along with GNU Emacs; see the file COPYING. If not, write to
4a1ac370d57a Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
24 ;; the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
4a1ac370d57a Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
25
4a1ac370d57a Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
26 ;;; Commentary:
4a1ac370d57a Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
27
4a1ac370d57a Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
28 ;; See the commentary of vc.el.
4a1ac370d57a Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
29
4a1ac370d57a Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
30 ;;; Code:
4a1ac370d57a Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
31
4a1ac370d57a Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
32 (defvar vc-master-templates
4a1ac370d57a Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
33 '(("%sRCS/%s,v" . RCS) ("%s%s,v" . RCS) ("%sRCS/%s" . RCS)
4a1ac370d57a Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
34 ("%sSCCS/s.%s" . SCCS) ("%ss.%s". SCCS))
4a1ac370d57a Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
35 "*Where to look for version-control master files.
4a1ac370d57a Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
36 The first pair corresponding to a given back end is used as a template
4a1ac370d57a Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
37 when creating new masters.")
4a1ac370d57a Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
38
4a1ac370d57a Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
39 (defvar vc-make-backup-files nil
4a1ac370d57a Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
40 "*If non-nil, backups of registered files are made according to
4a1ac370d57a Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
41 the make-backup-files variable. Otherwise, prevents backups being made.")
4a1ac370d57a Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
42
4a1ac370d57a Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
43 ;; Tell Emacs about this new kind of minor mode
4a1ac370d57a Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
44 (if (not (assoc 'vc-mode-string minor-mode-alist))
4a1ac370d57a Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
45 (setq minor-mode-alist (cons '(vc-mode-string vc-mode-string)
4a1ac370d57a Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
46 minor-mode-alist)))
4a1ac370d57a Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
47
4a1ac370d57a Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
48 (make-variable-buffer-local 'vc-mode-string)
4a1ac370d57a Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
49
4a1ac370d57a Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
50 ;; We need a notion of per-file properties because the version
4a1ac370d57a Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
51 ;; control state of a file is expensive to derive --- we don't
4a1ac370d57a Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
52 ;; want to recompute it even on every find.
4a1ac370d57a Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
53
4a1ac370d57a Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
54 (defvar vc-file-prop-obarray [0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0]
4a1ac370d57a Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
55 "Obarray for per-file properties.")
4a1ac370d57a Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
56
4a1ac370d57a Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
57 (defun vc-file-setprop (file property value)
4a1ac370d57a Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
58 ;; set per-file property
4a1ac370d57a Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
59 (put (intern file vc-file-prop-obarray) property value))
4a1ac370d57a Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
60
4a1ac370d57a Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
61 (defun vc-file-getprop (file property)
4a1ac370d57a Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
62 ;; get per-file property
4a1ac370d57a Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
63 (get (intern file vc-file-prop-obarray) property))
4a1ac370d57a Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
64
4a1ac370d57a Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
65 ;;; actual version-control code starts here
4a1ac370d57a Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
66
4a1ac370d57a Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
67 (defun vc-registered (file)
4a1ac370d57a Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
68 ;; Search for a master corresponding to the given file
4a1ac370d57a Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
69 (let ((dirname (or (file-name-directory file) ""))
4a1ac370d57a Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
70 (basename (file-name-nondirectory file)))
4a1ac370d57a Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
71 (catch 'found
4a1ac370d57a Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
72 (mapcar
4a1ac370d57a Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
73 (function (lambda (s)
4a1ac370d57a Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
74 (let ((trial (format (car s) dirname basename)))
4a1ac370d57a Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
75 (if (and (file-exists-p trial)
4a1ac370d57a Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
76 ;; Make sure the file we found with name
4a1ac370d57a Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
77 ;; TRIAL is not the source file itself.
4a1ac370d57a Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
78 ;; That can happen with RCS-style names
4a1ac370d57a Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
79 ;; if the file name is truncated
4a1ac370d57a Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
80 ;; (e.g. to 14 chars). See if either
4a1ac370d57a Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
81 ;; directory or attributes differ.
4a1ac370d57a Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
82 (or (not (string= dirname
4a1ac370d57a Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
83 (file-name-directory trial)))
4a1ac370d57a Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
84 (not (equal
4a1ac370d57a Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
85 (file-attributes file)
4a1ac370d57a Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
86 (file-attributes trial)))))
4a1ac370d57a Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
87 (throw 'found (cons trial (cdr s)))))))
4a1ac370d57a Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
88 vc-master-templates)
4a1ac370d57a Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
89 nil)
4a1ac370d57a Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
90 ))
4a1ac370d57a Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
91
4a1ac370d57a Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
92 (defun vc-backend-deduce (file)
4a1ac370d57a Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
93 "Return the version-control type of a file, nil if it is not registered"
4a1ac370d57a Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
94 (and file
4a1ac370d57a Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
95 (or (vc-file-getprop file 'vc-backend)
4a1ac370d57a Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
96 (vc-file-setprop file 'vc-backend (cdr (vc-registered file))))))
4a1ac370d57a Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
97
4a1ac370d57a Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
98 (defun vc-toggle-read-only ()
4a1ac370d57a Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
99 "If the file in the current buffer id under version control, perform the
4a1ac370d57a Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
100 logical next version-control action; otherwise, just toggle the buffer's
4a1ac370d57a Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
101 read-only flag."
4a1ac370d57a Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
102 (interactive)
4a1ac370d57a Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
103 (if (vc-backend-deduce (buffer-file-name))
4a1ac370d57a Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
104 (vc-next-action nil)
4a1ac370d57a Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
105 (toggle-read-only)))
4a1ac370d57a Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
106
4a1ac370d57a Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
107 (defun vc-mode-line (file &optional label)
4a1ac370d57a Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
108 "Set `vc-mode-string' to display type of version control for FILE.
4a1ac370d57a Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
109 The value is set in the current buffer, which should be the buffer
4a1ac370d57a Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
110 visiting FILE."
4a1ac370d57a Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
111 (let ((vc-type (vc-backend-deduce file)))
4a1ac370d57a Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
112 (if vc-type
4a1ac370d57a Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
113 (progn
4a1ac370d57a Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
114 (if (null (current-local-map))
4a1ac370d57a Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
115 (use-local-map (make-sparse-keymap)))
4a1ac370d57a Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
116 (define-key (current-local-map) "\C-x\C-q" 'vc-toggle-read-only)
4a1ac370d57a Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
117 (setq vc-mode-string
4a1ac370d57a Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
118 (concat " " (or label (symbol-name vc-type))))))
4a1ac370d57a Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
119 ;; force update of mode line
4a1ac370d57a Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
120 (set-buffer-modified-p (buffer-modified-p))
4a1ac370d57a Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
121 vc-type))
4a1ac370d57a Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
122
4a1ac370d57a Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
123 ;;; install a call to the above as a find-file hook
4a1ac370d57a Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
124 (defun vc-find-file-hook ()
4a1ac370d57a Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
125 (if (and (vc-mode-line buffer-file-name) (not vc-make-backup-files))
4a1ac370d57a Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
126 (progn
4a1ac370d57a Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
127 (make-local-variable 'make-backup-files)
4a1ac370d57a Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
128 (setq make-backup-files nil))))
4a1ac370d57a Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
129
4a1ac370d57a Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
130 (or (memq 'vc-find-file-hook find-file-hooks)
4a1ac370d57a Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
131 (setq find-file-hooks
4a1ac370d57a Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
132 (cons 'vc-find-file-hook find-file-hooks)))
4a1ac370d57a Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
133
4a1ac370d57a Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
134 ;;; more hooks, this time for file-not-found
4a1ac370d57a Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
135 (defun vc-file-not-found-hook ()
4a1ac370d57a Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
136 "When file is not found, try to check it out from RCS or SCCS.
4a1ac370d57a Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
137 Returns t if checkout was successful, nil otherwise."
4a1ac370d57a Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
138 (if (vc-backend-deduce buffer-file-name)
4a1ac370d57a Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
139 (progn
4a1ac370d57a Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
140 (require 'vc)
4a1ac370d57a Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
141 (not (vc-error-occurred (vc-checkout buffer-file-name))))))
4a1ac370d57a Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
142
4a1ac370d57a Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
143 (or (memq 'vc-file-not-found-hook find-file-not-found-hooks)
4a1ac370d57a Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
144 (setq find-file-not-found-hooks
4a1ac370d57a Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
145 (cons 'vc-file-not-found-hook find-file-not-found-hooks)))
4a1ac370d57a Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
146
4a1ac370d57a Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
147 ;;; Now arrange for bindings and autoloading of the main package.
4a1ac370d57a Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
148 ;;; Bindings for this have to go in the global map, as it may have
4a1ac370d57a Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
149 ;;; to coexist with a lot of different major modes.
4a1ac370d57a Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
150
4a1ac370d57a Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
151 (setq vc-prefix-map (lookup-key global-map "\C-xv"))
4a1ac370d57a Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
152 (if (not (keymapp vc-prefix-map))
4a1ac370d57a Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
153 (progn
4a1ac370d57a Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
154 (setq vc-prefix-map (make-sparse-keymap))
4a1ac370d57a Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
155 (define-key global-map "\C-xv" vc-prefix-map)
4a1ac370d57a Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
156 (define-key vc-prefix-map "a" 'vc-update-change-log)
4a1ac370d57a Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
157 (define-key vc-prefix-map "c" 'vc-cancel-version)
4a1ac370d57a Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
158 (define-key vc-prefix-map "d" 'vc-diff)
4a1ac370d57a Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
159 (define-key vc-prefix-map "h" 'vc-insert-headers)
4a1ac370d57a Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
160 (define-key vc-prefix-map "i" 'vc-register)
4a1ac370d57a Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
161 (define-key vc-prefix-map "l" 'vc-print-log)
4a1ac370d57a Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
162 (define-key vc-prefix-map "r" 'vc-retrieve-snapshot)
4a1ac370d57a Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
163 (define-key vc-prefix-map "s" 'vc-create-snapshot)
4a1ac370d57a Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
164 (define-key vc-prefix-map "u" 'vc-revert-buffer)
4a1ac370d57a Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
165 (define-key vc-prefix-map "v" 'vc-next-action)
4a1ac370d57a Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
166 (define-key vc-prefix-map "=" 'vc-directory)
4a1ac370d57a Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
167 ))
4a1ac370d57a Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
168
4a1ac370d57a Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
169 (provide 'vc-hooks)
4a1ac370d57a Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
170
4a1ac370d57a Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
171 ;;; vc-hooks.el ends here