comparison lisp/vc-hooks.el @ 2491:5f3061858f47

vc-mode: name change.
author Eric S. Raymond <esr@snark.thyrsus.com>
date Thu, 08 Apr 1993 16:35:57 +0000
parents 4f9d60f7de9d
children d26f75fd9f5e
comparison
equal deleted inserted replaced
2490:70d00ecacc0d 2491:5f3061858f47
1 ;;; vc-hooks.el --- resident support for version-control 1 ;;; vc-hooks.el --- resident support for version-control
2 2
3 ;; Copyright (C) 1992 Free Software Foundation, Inc. 3 ;; Copyright (C) 1992 Free Software Foundation, Inc.
4 4
5 ;; Author: Eric S. Raymond <esr@snark.thyrsus.com> 5 ;; Author: Eric S. Raymond <esr@snark.thyrsus.com>
6 ;; Version: 5.2 6 ;; Version: 5.3
7
8 ;; $Id: vc-hooks.el,v 1.10 1993/03/17 14:01:56 eric Exp eric $
9 7
10 ;; This file is part of GNU Emacs. 8 ;; This file is part of GNU Emacs.
11 9
12 ;; GNU Emacs is free software; you can redistribute it and/or modify 10 ;; 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 11 ;; it under the terms of the GNU General Public License as published by
39 (defvar vc-make-backup-files nil 37 (defvar vc-make-backup-files nil
40 "*If non-nil, backups of registered files are made according to 38 "*If non-nil, backups of registered files are made according to
41 the make-backup-files variable. Otherwise, prevents backups being made.") 39 the make-backup-files variable. Otherwise, prevents backups being made.")
42 40
43 ;; Tell Emacs about this new kind of minor mode 41 ;; Tell Emacs about this new kind of minor mode
44 (if (not (assoc 'vc-mode-string minor-mode-alist)) 42 (if (not (assoc 'vc-mode minor-mode-alist))
45 (setq minor-mode-alist (cons '(vc-mode-string vc-mode-string) 43 (setq minor-mode-alist (cons '(vc-mode vc-mode)
46 minor-mode-alist))) 44 minor-mode-alist)))
47 45
48 (make-variable-buffer-local 'vc-mode-string) 46 (make-variable-buffer-local 'vc-mode)
49 47
50 ;; We need a notion of per-file properties because the version 48 ;; We need a notion of per-file properties because the version
51 ;; control state of a file is expensive to derive --- we don't 49 ;; control state of a file is expensive to derive --- we don't
52 ;; want to recompute it even on every find. 50 ;; want to recompute it even on every find.
53 51
117 (if (vc-backend-deduce (buffer-file-name)) 115 (if (vc-backend-deduce (buffer-file-name))
118 (vc-next-action nil) 116 (vc-next-action nil)
119 (toggle-read-only))) 117 (toggle-read-only)))
120 118
121 (defun vc-mode-line (file &optional label) 119 (defun vc-mode-line (file &optional label)
122 "Set `vc-mode-string' to display type of version control for FILE. 120 "Set `vc-mode' to display type of version control for FILE.
123 The value is set in the current buffer, which should be the buffer 121 The value is set in the current buffer, which should be the buffer
124 visiting FILE." 122 visiting FILE."
125 (interactive (list buffer-file-name nil)) 123 (interactive (list buffer-file-name nil))
126 (let ((vc-type (vc-backend-deduce file))) 124 (let ((vc-type (vc-backend-deduce file)))
127 (if vc-type 125 (if vc-type
128 (progn 126 (progn
129 (if (null (current-local-map)) 127 (if (null (current-local-map))
130 (use-local-map (make-sparse-keymap))) 128 (use-local-map (make-sparse-keymap)))
131 (define-key (current-local-map) "\C-x\C-q" 'vc-toggle-read-only) 129 (define-key (current-local-map) "\C-x\C-q" 'vc-toggle-read-only)
132 (setq vc-mode-string 130 (setq vc-mode
133 (concat " " (or label (symbol-name vc-type)))))) 131 (concat " " (or label (symbol-name vc-type))))))
134 ;; force update of mode line 132 ;; force update of mode line
135 (set-buffer-modified-p (buffer-modified-p)) 133 (set-buffer-modified-p (buffer-modified-p))
136 vc-type)) 134 vc-type))
137 135
161 (or (memq 'vc-file-not-found-hook find-file-not-found-hooks) 159 (or (memq 'vc-file-not-found-hook find-file-not-found-hooks)
162 (setq find-file-not-found-hooks 160 (setq find-file-not-found-hooks
163 (cons 'vc-file-not-found-hook find-file-not-found-hooks))) 161 (cons 'vc-file-not-found-hook find-file-not-found-hooks)))
164 162
165 ;;; Now arrange for bindings and autoloading of the main package. 163 ;;; Now arrange for bindings and autoloading of the main package.
166 ;;; Bindings for this have to go in the global map, as it may have 164 ;;; Bindings for this have to go in the global map, as we'll often
167 ;;; to coexist with a lot of different major modes. 165 ;;; want to call them from random buffers.
168 166
169 (setq vc-prefix-map (lookup-key global-map "\C-xv")) 167 (setq vc-prefix-map (lookup-key global-map "\C-xv"))
170 (if (not (keymapp vc-prefix-map)) 168 (if (not (keymapp vc-prefix-map))
171 (progn 169 (progn
172 (setq vc-prefix-map (make-sparse-keymap)) 170 (setq vc-prefix-map (make-sparse-keymap))