Hello.
Suppose the following workflow for exploring code, under version
control:
1. Start emacs: emacs -Q.
2. Visit a directory in Dired mode, e.g. C-x d "emacs/lisp/eshell".
3. Navigate to a file, and type 'v'.
4. While exploring, one may wish to switch branch, so type:
C-x v r BRANCH-NAME
I find the following to be inconsistent:
'vc-retrieve-tag' makes an effort to preserve the modes in the file.
So it preserves View mode. But the file is no longer read-only. This
way, the buffer ends up being writable, but with View mode enabled, and
I find it a little confusing. I understand if that is to respect
'revert-buffer' design, as I infer from this message:
[1]
https://lists.gnu.org/archive/html/emacs-devel/2004-09/msg00002.htmlBut I think the user could at least be warned about this, in the manual
(perhaps in the VC Branches section).
After reading [1], I tested the workflow with auto-revert-mode set to 't', and
it works as expected, based on the information in the following messages
to [1].
Trying out simple solutions for myself, I answered "no" to the prompt
that VC puts: "Update any affected buffers? (yes or no)". I wouldn't
answer no in the workflow I described, but I answered "no" just for the
sake of it. I ended up with the buffer being updated, and again with
View mode enabled, but not with buffer-read-only set to 't'.
So I wonder, what is the effect of answering "yes" or "no"? What does
it update, and what does it not? I couldn't find such information in
the VC section of the manual.
Please, consider either improving what 'vc-retrieve-tag' does, regarding the
previous state of the buffer, or improving the documentation about this
behavior. Or, if you think I'm plain wrong, please explain me the
reasons, since I would like to understand more of it.
Best regards,
Mauro.