unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: "Jay Berkenbilt" <ejb@ql.org>
To: "Eli Zaretskii" <eliz@gnu.org>
Cc: Glenn Morris <rgm@gnu.org>, Lars Ingebrigtsen <larsi@gnus.org>,
	Michael Albinus <michael.albinus@gmx.de>,
	53207@debbugs.gnu.org
Subject: bug#53207: 28.0.91; create-lockfiles nil breaks file change detection
Date: Thu, 13 Jan 2022 10:47:21 -0500	[thread overview]
Message-ID: <b2fdb89f-e79b-4d37-be32-bd233e49282f@www.fastmail.com> (raw)
In-Reply-To: <83h7a73fab.fsf@gnu.org>



On Thu, Jan 13, 2022, at 9:02 AM, Eli Zaretskii wrote:
> > Date: Thu, 13 Jan 2022 08:11:34 -0500
> > From: "Jay Berkenbilt" <ejb@ql.org>
> > Cc: 53207@debbugs.gnu.org
> > 
> > For my edification, can you explain how the 27.2 behavior of noticing
> > when a file's contents had changed immediately is not adequate without
> > lockfiles?
> 
> First, Emacs 27 wasn't looking at the file's contents, it was looking
> at the file's modification time.

My original recipe for reproducing the issue demonstrated that, after
"touch file", you can continue editing freely and save, but after
changing the contents, you can't. I don't remember when this first
changed, maybe emacs 27 or 26. For ages before that, it was
modification time. I remember noticing when updating the modtime
without changing the content stopped triggering that. I was delighted.

It is definitely the case that just updating the modification time on
emacs 27.2 does not trigger this. You can try it. In emacs -Q, edit a
file and save. From the shell, touch the file. No continue editing the
file and save again. No warning. At least this is the case on my
Ubuntu Linux 20.04 system with emacs compiled from source.

> > It seems to me that there are two separate issues here. A lock file
> > would enable you to immediately notice if a user on a *different
> > system* is in the process of editing a file and has unsaved changes.
> 
> No, it also works when the same user on the same system edited the
> file from another Emacs session.  That is a valid use case: some
> people start more than a single Emacs session on the same system.

Granted. Of course it doesn't protect against another very common use
case, which is people opening the same file in emacs and
simultaneously in something like VS Code or another IDE. I know
developers that work this way day in and day out -- they use emacs for
most of their editing but hop over to an IDE to take advantage of
project-wide integrations, better test integration, a more advanced
debugger, or better out-of-the-box functionality with their
programming language or environment of choice. So lock files remain a
solution that only works in an emacs-only environment, while noticing
that the file's modification time has changed is universal, and
noticing that a file's content has changed is a great advancement over
just noticing modtime since it allows for workflows like git rebase.

> > On the other hand, the other behavior I'm talking about allows you to
> > notice immediately when you begin editing if the file on disk has
> > become out of sync with the buffer contents.
> 
> That part is done when you save the buffer.  It is unaffected by
> create-lockfiles.

It is also done when you start editing a buffer, as shown in my original
message. Really. Try it.





  reply	other threads:[~2022-01-13 15:47 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-12 14:30 bug#53207: 28.0.91; create-lockfiles nil breaks file change detection Jay Berkenbilt
2022-01-12 17:26 ` Eli Zaretskii
2022-01-12 20:07   ` Jay Berkenbilt
2022-01-12 20:45     ` Eli Zaretskii
2022-01-12 21:35       ` Jay Berkenbilt
2022-01-13  6:43         ` Eli Zaretskii
2022-01-13 13:06           ` Jay Berkenbilt
2022-01-12 18:13 ` Glenn Morris
2022-01-12 18:41   ` Philipp Stephani
2022-01-13 10:54   ` Eli Zaretskii
2022-01-13 13:11     ` Jay Berkenbilt
2022-01-13 13:24       ` Philipp Stephani
2022-01-13 14:02       ` Eli Zaretskii
2022-01-13 15:47         ` Jay Berkenbilt [this message]
2022-01-14 14:26           ` Michael Albinus
2022-01-14 14:43             ` Eli Zaretskii
2022-01-14 16:11             ` Glenn Morris
2022-01-14 16:44               ` Eli Zaretskii
2022-01-15  8:06               ` Lars Ingebrigtsen
2022-01-15  8:16                 ` Lars Ingebrigtsen
2022-01-15  9:23                 ` Eli Zaretskii
2022-01-27 17:19                   ` Eli Zaretskii
2022-01-28 13:42                     ` Lars Ingebrigtsen
2022-01-28 14:30                       ` Eli Zaretskii
2022-01-28 14:56                         ` Michael Albinus
2022-01-28 15:16                           ` Eli Zaretskii
2022-01-29 10:53                             ` Michael Albinus
2022-01-29 10:57                               ` Eli Zaretskii
2022-02-03 13:31                                 ` Michael Albinus

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=b2fdb89f-e79b-4d37-be32-bd233e49282f@www.fastmail.com \
    --to=ejb@ql.org \
    --cc=53207@debbugs.gnu.org \
    --cc=eliz@gnu.org \
    --cc=larsi@gnus.org \
    --cc=michael.albinus@gmx.de \
    --cc=rgm@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).