[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Don't complain about changed file when it hasn't changed
From: |
Stefan Monnier |
Subject: |
Re: Don't complain about changed file when it hasn't changed |
Date: |
Mon, 29 Aug 2016 10:50:04 -0400 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/25.1.50 (gnu/linux) |
>> The patch below is supposed to change Emacs such that if the file's
>> timestamp has changed, but the contents is still the same, it doesn't
>> prompt the user about a supersession-threat.
> Thanks. Can you describe the use case(s) where this is important?
I think a common case nowadays is using Git's checkout and stash where
you might change a file temporarily and then get back to its previous
state (but with a different timestamp).
Another I've bumped into several times is when you "touch <file>" for
purposes such as forcing a re-compilation.
> Is it possible there are some use cases where this should be turned
> off (in which case we might need a user option)?
I couldn't think of any, but I'm not 100% positive that there can't be,
that's why I'm asking for objections here ;-)
> . compare-buffer-substrings is sensitive to case-fold-search value of
> the current buffer, while we want the comparison case-sensitive
Oh, indeed. I missed that it doesn't work like compare-strings. Thanks.
> . need to bind coding-system-for-read to the encoding of the file's
> buffer, otherwise you could get spurious false alarms, e.g. if the
> file being checked was visited with non-default decoding (C-x RET c)
Yes, I noticed that recently (tho I'm not worried about false alarms,
but rather about silently considering that the file hasn't changed
although it has).
> . the file's buffer could be unibyte, in which case you want
> insert-file-contents-literally, I think
We could try to be more careful in this way, indeed. But AFAIK the only
risk here is to flag a file as being changed when it hasn't, which is no
worse than what we currently do (i.e. a false alarm), so I'm not sure
it's worth the trouble.
> . insert-file-contents could run out of memory, or hit some other
> error, so I think you should catch any errors and consider the
> check failed in that case
Sure.
> And, of course, please provide documentation for the feature.
Not sure what there is to document, actually (I do have a NEWS entry for
it, OTOH).
Stefan
Re: Don't complain about changed file when it hasn't changed, Rolf Ade, 2016/08/30
Re: Don't complain about changed file when it hasn't changed,
Stefan Monnier <=
- Re: Don't complain about changed file when it hasn't changed, Eli Zaretskii, 2016/08/30
- Re: Don't complain about changed file when it hasn't changed, Stefan Monnier, 2016/08/30
- Re: Don't complain about changed file when it hasn't changed, Eli Zaretskii, 2016/08/30
- Re: Don't complain about changed file when it hasn't changed, Stefan Monnier, 2016/08/30
- Re: Don't complain about changed file when it hasn't changed, Eli Zaretskii, 2016/08/30
- Re: Don't complain about changed file when it hasn't changed, Stefan Monnier, 2016/08/30
Re: Don't complain about changed file when it hasn't changed, Stefan Monnier, 2016/08/30
Re: Don't complain about changed file when it hasn't changed, Eli Zaretskii, 2016/08/30
Re: Don't complain about changed file when it hasn't changed, Stefan Monnier, 2016/08/30
Re: Don't complain about changed file when it hasn't changed, Eli Zaretskii, 2016/08/30