bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#21435: 25.0.50; file-notify has problems after renames


From: Michael Albinus
Subject: bug#21435: 25.0.50; file-notify has problems after renames
Date: Fri, 11 Sep 2015 14:51:15 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.0.50 (gnu/linux)

Eli Zaretskii <eliz@gnu.org> writes:

>> > They shouldn't rely on that in the first place, since this is
>> > unreliable, as we just saw.
>> 
>> Nope. When filenotify.el sends a `renamed' event, it must be
>> reliable.
>
> That's not what I meant.  What I meant was that applications cannot
> rely on getting a 'renamed' event when files are moved between
> directories, they should be prepared to deal with 'deleted' and
> 'created' anyway.

Ahh, I misunderstood you. And yes, I don't believe it is a burden for
applications to react on `renamed', `deleted' and `created'.

> Those use cases will have to handle 'deleted' and 'created', if they
> want to work on all supported platforms.  By sending sometimes
> 'renamed' and sometimes 'deleted' followed by 'created', we ask the
> users to do more work, and gratuitously expose them to platform
> differences that filenotify.el was supposed to conceal.

I believe we don't have platform differences. On all supported
platforms, we could compose a `renamed' event. gfilenotify sends
`rename', inotify sends the `moved-from' / `moved-to' pair, and
w32notify sends the `renamed-from' / `renamed-to' pair.

None of the platforms guarantees, that a move operation will result in
those events, remember the case of moving a file from a local disk to a
mounted disk (a share for MS-Windows). Then they send their `deleted' /
`created' equivalents.

What we do is harmonizing a little bit the different native
libraries. We don't do anything else.

>> There is already a difference: native gfilenotify gives us a `rename'
>> event. Shall we convert it to `deleted' and `created'?
>
> Yes.

Here I disagree.

>> This would reduce the information.
>
> Applications that don't want to lose that information can always call
> back-ends directly.  By using filenotify.el, they agree to losing some
> information, and in return gain uniformity and less coding.

See the example above. It would be a horror for them to handle all the
different low-level events. filenotify.el would simplify it. And again,
I don't believe it is too much work for an application, to handle a
`renamed' event, when they are already capable to handle `deleted' and
`created' events.

> In the same directory, there _is_ a 'renamed' event.  We are
> discussing a situation when a file was moved to another directory,
> which is not what this scenario is about.

A handler of an application always knows which directory it is
watching. Where's the problem?

Best regards, Michael.





reply via email to

[Prev in Thread] Current Thread [Next in Thread]