bug#2623: 23.0.91; File is under version-control; use C-x v v to check in/out

Leo <[email protected]>
Newsgroups gmane.emacs.bugs,gmane.emacs.pretest.bugs
Organization University of Cambridge
Message-ID <[email protected]>
On 2009-03-12 00:39 +0000, Stefan Monnier wrote:
>>>>> BTW, why did you type C-x C-q?  Is the file read-only?
>>>> Sometimes I turn the file into read-only before showing to other people
>>>> in case they accidentally type something into it.
>>> I see, so in this case we could probably avoid the message by being
>>> a bit more clever (e.g. don't show the message if it's not the first
>>> time C-x C-q is used in this buffer).
>> There is difference between turning the buffer into read-only and the
>> file on disk being read-only. VC backends depend on the latter for their
>> status based on my experience with RCS. So showing such a message does
>
> No, actually VC did make buffers read-only based on the backend's
> status rather than just based on the file's own read-onlyness.  And
> C-x C-q was used by many people as the main way to interact with VC
> (both to check out and to check back in).  I know it all sounds really
> odd seen from today's point of view, but it still made sense in
> Emacs-21, which isn't that old.

The message is wrong when the underlying vc backend does not use such a
backward mechanism. However, toggle-read-only unconditionally show this
message.

This situation can be improved by a one line change:

--- /tmp/emacs/share/emacs/23.0.60/lisp/files.el.gz
+++ /tmp/buffer-content-32645B0g
@@ -4429,7 +4429,7 @@
       (view-mode-enter))
      (t (setq buffer-read-only (not buffer-read-only))
         (force-mode-line-update)))
-    (if (vc-backend buffer-file-name)
+    (if (memq (vc-backend buffer-file-name) '(RCS SCCS))
         (message "%s" (substitute-command-keys
                   (concat "File is under version-control; "
                           "use \\[vc-next-action] to check in/out"))))))

Diff finished.  Thu Mar 12 17:56:16 2009

I have no idea whether SCCS uses read-only mechanism tho. But it is
better to delete this 'message' from toggle-read-only. It looks out of
place and it is not even documented in the doc string.

I am curious how would C-x C-q have anything to do with vc. Even when
using RCS backend, it never is part of the work flow.

>         Stefan

-- 
.:  Leo  :.  [ sdl.web AT gmail.com ]  .: I use Emacs :.

               www.git-scm.com
    git - the one true version control system
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.