[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Bug-gnu-emacs] Re: C-x C-q more useful as toggle-read-only
From: |
Ehud Karni |
Subject: |
Re: [Bug-gnu-emacs] Re: C-x C-q more useful as toggle-read-only |
Date: |
Wed, 20 Sep 2000 15:24:06 +0300 |
Stephen Gildea opened the discussion on C-x C-q and toggle-read-only.
I was not satisfied with the fundamental behavior of
`vc-toggle-read-only'. Many mistakes happened in our site because of
the "toggle" nature of this function and it dependency on the write
permission of the file (it checked out the RCS version without
warning too much times).
My solution was writing 2 new defuns: `vc-checkin-or-register' and
`vc-checkout-lock' (both are listed below) and assigning them to
different keys (C-x v i, C-x v o).
This happened some years ago, and the VC management may improved, but
the users on my site are happy with the 2 distinct functions.
As for the `toggle-read-only' it is assigned to an unrelated key (and
also in the menu). It is used many times, even with version controlled
files, but NEVER for VC use.
Ehud.
(defun vc-checkin-or-register (verbose)
"checkin the current file into RCS (if registered) or register it now if not
already registered. Offer to save the buffer if not saved."
(interactive "P")
(let (rev
(file (vc-get-file-name verbose "checkin/register")))
(setq rev (nth 1 file))
(setq file (nth 0 file))
(vc-buffer-sync) ;;offer to save if needed
(vc-file-clearprops file) ;;clear properties
(if (vc-name file) ;;file registered ?
(vc-checkin file rev) ;;yes - checkin
(vc-register)))) ;;no - register
(defun vc-checkout-lock ()
"Retrieve a writable copy of the latest version of the current buffer's file."
(interactive)
(vc-checkout (nth 0 (vc-get-file-name nil "")) t))
--
@@@@@@ @@@ @@@@@@ @ @ Ehud Karni Simon & Wiesel Insurance agency
@ @ @ @@ @ Tel: +972-3-6212-757 Fax: +972-3-6292-544
@ @ @ @ @ @@ (USA) Fax and voice mail: 1-815-5509341
@ @ @ @ @ @ Better Safe Than Sorry
http://www.simonwiesel.co.il mailto:ehud@unix.simonwiesel.co.il