unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#35166: 27.0.50; Buffer state inconsistent after vc-retrieve-tag
@ 2019-04-05 21:41 Mauro Aranda
  2019-05-04 21:16 ` Mauro Aranda
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Mauro Aranda @ 2019-04-05 21:41 UTC (permalink / raw)
  To: 35166

[-- Attachment #1: Type: text/plain, Size: 1820 bytes --]

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.html
But 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.

[-- Attachment #2: Type: text/html, Size: 2198 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

* bug#35166: 27.0.50; Buffer state inconsistent after vc-retrieve-tag
  2019-04-05 21:41 bug#35166: 27.0.50; Buffer state inconsistent after vc-retrieve-tag Mauro Aranda
@ 2019-05-04 21:16 ` Mauro Aranda
  2021-06-22 17:30 ` Lars Ingebrigtsen
  2022-08-24 11:39 ` Lars Ingebrigtsen
  2 siblings, 0 replies; 7+ messages in thread
From: Mauro Aranda @ 2019-05-04 21:16 UTC (permalink / raw)
  To: 35166

[-- Attachment #1: Type: text/plain, Size: 30 bytes --]

Hello.

Any thoughts on this?

[-- Attachment #2: Type: text/html, Size: 86 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

* bug#35166: 27.0.50; Buffer state inconsistent after vc-retrieve-tag
  2019-04-05 21:41 bug#35166: 27.0.50; Buffer state inconsistent after vc-retrieve-tag Mauro Aranda
  2019-05-04 21:16 ` Mauro Aranda
@ 2021-06-22 17:30 ` Lars Ingebrigtsen
  2021-06-22 17:40   ` Lars Ingebrigtsen
  2021-06-23 15:13   ` Mauro Aranda
  2022-08-24 11:39 ` Lars Ingebrigtsen
  2 siblings, 2 replies; 7+ messages in thread
From: Lars Ingebrigtsen @ 2021-06-22 17:30 UTC (permalink / raw)
  To: Mauro Aranda; +Cc: 35166

Mauro Aranda <maurooaranda@gmail.com> writes:

> 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.

I can confirm that this behaviour is still present in Emacs 28.

> 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.html

I think this was changed in:

commit 90e118abf2dcc4aca4d7a7642247fa488554351e
Author:     Luc Teirlinck <teirllm@auburn.edu>
AuthorDate: Fri Sep 3 22:28:10 2004 +0000

    (auto-revert-handler): Bind `buffer-read-only' locally around the call
    to `revert-buffer'.

Reversion now preserves buffer-readedness, if I understand correctly.

> 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.

I think it would make sense for `vc-retrieve-tag' to preserve the
readedness of the buffer.  Anybody got any comments here?

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no





^ permalink raw reply	[flat|nested] 7+ messages in thread

* bug#35166: 27.0.50; Buffer state inconsistent after vc-retrieve-tag
  2021-06-22 17:30 ` Lars Ingebrigtsen
@ 2021-06-22 17:40   ` Lars Ingebrigtsen
  2021-06-23 15:13   ` Mauro Aranda
  1 sibling, 0 replies; 7+ messages in thread
From: Lars Ingebrigtsen @ 2021-06-22 17:40 UTC (permalink / raw)
  To: Mauro Aranda; +Cc: 35166

Lars Ingebrigtsen <larsi@gnus.org> writes:

> Reversion now preserves buffer-readedness, if I understand correctly.

Er, sorry -- not it doesn't -- only automatic autoreversion does, as
Mauro already said.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no





^ permalink raw reply	[flat|nested] 7+ messages in thread

* bug#35166: 27.0.50; Buffer state inconsistent after vc-retrieve-tag
  2021-06-22 17:30 ` Lars Ingebrigtsen
  2021-06-22 17:40   ` Lars Ingebrigtsen
@ 2021-06-23 15:13   ` Mauro Aranda
  2021-07-22 14:25     ` Lars Ingebrigtsen
  1 sibling, 1 reply; 7+ messages in thread
From: Mauro Aranda @ 2021-06-23 15:13 UTC (permalink / raw)
  To: Lars Ingebrigtsen; +Cc: 35166

Lars Ingebrigtsen <larsi@gnus.org> writes:

> Mauro Aranda <maurooaranda@gmail.com> writes:
>
>> 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.
>
> I think it would make sense for `vc-retrieve-tag' to preserve the
> readedness of the buffer.  Anybody got any comments here?

FWIW, I've been saving the readedness since I reported this bug by using
before-revert-hook and after-revert-hook.

I don't know if vc-retrieve-tag should save it, but I think leaving the
buffer in this state (view-mode on and not read-only) should be avoided,
if possible.





^ permalink raw reply	[flat|nested] 7+ messages in thread

* bug#35166: 27.0.50; Buffer state inconsistent after vc-retrieve-tag
  2021-06-23 15:13   ` Mauro Aranda
@ 2021-07-22 14:25     ` Lars Ingebrigtsen
  0 siblings, 0 replies; 7+ messages in thread
From: Lars Ingebrigtsen @ 2021-07-22 14:25 UTC (permalink / raw)
  To: Mauro Aranda; +Cc: 35166

Mauro Aranda <maurooaranda@gmail.com> writes:

> FWIW, I've been saving the readedness since I reported this bug by using
> before-revert-hook and after-revert-hook.
>
> I don't know if vc-retrieve-tag should save it, but I think leaving the
> buffer in this state (view-mode on and not read-only) should be avoided,
> if possible.

Nobody else had an opinion, so I've now made revert-buffer preserve
buffer-read-only on the trunk, and we'll see whether that messes up
anybody's work flow...

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no





^ permalink raw reply	[flat|nested] 7+ messages in thread

* bug#35166: 27.0.50; Buffer state inconsistent after vc-retrieve-tag
  2019-04-05 21:41 bug#35166: 27.0.50; Buffer state inconsistent after vc-retrieve-tag Mauro Aranda
  2019-05-04 21:16 ` Mauro Aranda
  2021-06-22 17:30 ` Lars Ingebrigtsen
@ 2022-08-24 11:39 ` Lars Ingebrigtsen
  2 siblings, 0 replies; 7+ messages in thread
From: Lars Ingebrigtsen @ 2022-08-24 11:39 UTC (permalink / raw)
  To: Mauro Aranda; +Cc: 35166

Mauro Aranda <maurooaranda@gmail.com> writes:

> 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

This is now fixed in Emacs 29.






^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2022-08-24 11:39 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-04-05 21:41 bug#35166: 27.0.50; Buffer state inconsistent after vc-retrieve-tag Mauro Aranda
2019-05-04 21:16 ` Mauro Aranda
2021-06-22 17:30 ` Lars Ingebrigtsen
2021-06-22 17:40   ` Lars Ingebrigtsen
2021-06-23 15:13   ` Mauro Aranda
2021-07-22 14:25     ` Lars Ingebrigtsen
2022-08-24 11:39 ` Lars Ingebrigtsen

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).