emacs-devel
[Top][All Lists]
Advanced

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

Re: filenotify.el


From: Michael Albinus
Subject: Re: filenotify.el
Date: Wed, 26 Jun 2013 16:15:17 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux)

Stefan Monnier <address@hidden> writes:

>> In this case, we must ensure that the incoming file-notify events can
>> be distinguished.
>
> Where?  In the C code or in filenotify.el?  AFAICT, at the Elisp level,
> a callback is only called for a given "watcher" (which is even more
> specific than a "notification library"), so I see no reason why
> a callback setup with inotify-add-watch should be called by gfilenotify,
> for example.

Imagine there are two registered watchers:

(gfile-add-watch "/tmp" flags1 'callback1)
(inotify-add-watch "/tmp" flags2 'callback2)

Both return the same descriptor, let's say 1. What would you call, when
there is an incoming event (1 flag "123") for the file "/tmp/123"? Would
you apply callback1 or callback2? You don't know whether the event comes
from gfilenotify or inotify. Maybe one could distinguish wrt the
returned flag, but I wouldn't bet that's always unique.

>> Such an event looks like (DESCRIPTOR ACTION FILE). Different low-level
>> packages must use unique DESCRIPTORs then.
>
> Just use (inotify DESCRIPTOR ACTION FILE) instead, if that's really needed.

I would make the descriptor a cons cell '(inotify . number), but it is
the same idea. Again, for Tramp I use already a vector as descriptor.
The only promise we have given is, that descriptors returned by
*-add-watch functions can be distinguished via `equal'.

No need to change it today, because there are no two packages linked in
parallel yet. But this might be needed in the future.

>         Stefan

Best regards, Michael.



reply via email to

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