311 |
when the user saves the first changes to the file. |
when the user saves the first changes to the file. |
312 |
|
|
313 |
'locking FILE is read-only if up-to-date; user must type |
'locking FILE is read-only if up-to-date; user must type |
314 |
\\[vc-toggle-read-only] before editing. Strict locking |
\\[vc-next-action] before editing. Strict locking |
315 |
is assumed. |
is assumed. |
316 |
|
|
317 |
'announce FILE is read-only if up-to-date; user must type |
'announce FILE is read-only if up-to-date; user must type |
318 |
\\[vc-toggle-read-only] before editing. But other users |
\\[vc-next-action] before editing. But other users |
319 |
may be editing at the same time." |
may be editing at the same time." |
320 |
(or (vc-file-getprop file 'vc-checkout-model) |
(or (vc-file-getprop file 'vc-checkout-model) |
321 |
(if (vc-backend file) |
(if (vc-backend file) |
453 |
|
|
454 |
(defun vc-toggle-read-only (&optional verbose) |
(defun vc-toggle-read-only (&optional verbose) |
455 |
"Change read-only status of current buffer, perhaps via version control. |
"Change read-only status of current buffer, perhaps via version control. |
456 |
|
|
457 |
If the buffer is visiting a file registered with version control, |
If the buffer is visiting a file registered with version control, |
458 |
then check the file in or out. Otherwise, just change the read-only flag |
then check the file in or out. Otherwise, just change the read-only flag |
459 |
of the buffer. |
of the buffer. |
460 |
With prefix argument, ask for version number to check in or check out. |
With prefix argument, ask for version number to check in or check out. |
461 |
Check-out of a specified version number does not lock the file; |
Check-out of a specified version number does not lock the file; |
462 |
to do that, use this command a second time with no argument." |
to do that, use this command a second time with no argument. |
463 |
|
|
464 |
|
If you bind this function to \\[toggle-read-only], then Emacs checks files |
465 |
|
in or out whenever you toggle the read-only flag." |
466 |
(interactive "P") |
(interactive "P") |
467 |
(if (or (and (boundp 'vc-dired-mode) vc-dired-mode) |
(if (or (and (boundp 'vc-dired-mode) vc-dired-mode) |
468 |
;; use boundp because vc.el might not be loaded |
;; use boundp because vc.el might not be loaded |
469 |
(vc-backend (buffer-file-name))) |
(vc-backend (buffer-file-name))) |
470 |
(vc-next-action verbose) |
(vc-next-action verbose) |
471 |
(toggle-read-only))) |
(toggle-read-only))) |
|
(define-key global-map "\C-x\C-q" 'vc-toggle-read-only) |
|
472 |
|
|
473 |
(defun vc-default-make-version-backups-p (backend file) |
(defun vc-default-make-version-backups-p (backend file) |
474 |
"Return non-nil if unmodified versions should be backed up locally. |
"Return non-nil if unmodified versions should be backed up locally. |