Mercurial > emacs
comparison lisp/vc-hooks.el @ 2620:d26f75fd9f5e
(vc-mode-line): Don't alter key bindings.
(vc-toggle-read-only): Put on C-x C-q unconditionally.
(vc-mode): Add permanent-local property.
author | Richard M. Stallman <rms@gnu.org> |
---|---|
date | Sat, 01 May 1993 15:00:34 +0000 |
parents | 5f3061858f47 |
children | 763bc1ba714e |
comparison
equal
deleted
inserted
replaced
2619:019278028c54 | 2620:d26f75fd9f5e |
---|---|
42 (if (not (assoc 'vc-mode minor-mode-alist)) | 42 (if (not (assoc 'vc-mode minor-mode-alist)) |
43 (setq minor-mode-alist (cons '(vc-mode vc-mode) | 43 (setq minor-mode-alist (cons '(vc-mode vc-mode) |
44 minor-mode-alist))) | 44 minor-mode-alist))) |
45 | 45 |
46 (make-variable-buffer-local 'vc-mode) | 46 (make-variable-buffer-local 'vc-mode) |
47 (put 'vc-mode 'permanent-local t) | |
47 | 48 |
48 ;; We need a notion of per-file properties because the version | 49 ;; We need a notion of per-file properties because the version |
49 ;; control state of a file is expensive to derive --- we don't | 50 ;; control state of a file is expensive to derive --- we don't |
50 ;; want to recompute it even on every find. | 51 ;; want to recompute it even on every find. |
51 | 52 |
106 (and file | 107 (and file |
107 (or (vc-file-getprop file 'vc-backend) | 108 (or (vc-file-getprop file 'vc-backend) |
108 (vc-file-setprop file 'vc-backend (cdr (vc-registered file)))))) | 109 (vc-file-setprop file 'vc-backend (cdr (vc-registered file)))))) |
109 | 110 |
110 (defun vc-toggle-read-only () | 111 (defun vc-toggle-read-only () |
111 "If the file in the current buffer is under version control, perform the | 112 "Change read-only status of current buffer, perhaps via version control. |
112 logical next version-control action; otherwise, just toggle the buffer's | 113 If the buffer is visiting a file registered with version control, |
113 read-only flag." | 114 then check the file in or out. Otherwise, just change the read-only flag |
115 of the buffer." | |
114 (interactive) | 116 (interactive) |
115 (if (vc-backend-deduce (buffer-file-name)) | 117 (if (vc-backend-deduce (buffer-file-name)) |
116 (vc-next-action nil) | 118 (vc-next-action nil) |
117 (toggle-read-only))) | 119 (toggle-read-only))) |
120 (define-key global-map "\C-x\C-q" 'vc-toggle-read-only) | |
118 | 121 |
119 (defun vc-mode-line (file &optional label) | 122 (defun vc-mode-line (file &optional label) |
120 "Set `vc-mode' to display type of version control for FILE. | 123 "Set `vc-mode' to display type of version control for FILE. |
121 The value is set in the current buffer, which should be the buffer | 124 The value is set in the current buffer, which should be the buffer |
122 visiting FILE." | 125 visiting FILE." |
123 (interactive (list buffer-file-name nil)) | 126 (interactive (list buffer-file-name nil)) |
124 (let ((vc-type (vc-backend-deduce file))) | 127 (let ((vc-type (vc-backend-deduce file))) |
125 (if vc-type | 128 (if vc-type |
126 (progn | 129 (progn |
127 (if (null (current-local-map)) | |
128 (use-local-map (make-sparse-keymap))) | |
129 (define-key (current-local-map) "\C-x\C-q" 'vc-toggle-read-only) | |
130 (setq vc-mode | 130 (setq vc-mode |
131 (concat " " (or label (symbol-name vc-type)))))) | 131 (concat " " (or label (symbol-name vc-type)))))) |
132 ;; force update of mode line | 132 ;; force update of mode line |
133 (set-buffer-modified-p (buffer-modified-p)) | 133 (set-buffer-modified-p (buffer-modified-p)) |
134 vc-type)) | 134 vc-type)) |