emacs-devel
[Top][All Lists]
Advanced

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

Re: OSX FSEvents file watching support


From: Muir Manders
Subject: Re: OSX FSEvents file watching support
Date: Thu, 18 Jul 2019 07:38:54 -0700
User-agent: Cyrus-JMAP/3.1.6-736-gdfb8e44-fmstable-20190718v2

> What do you mean by "recursive watching"?  ... watching changes in all the 
> subdirectories ...?

Yes, I mean specifying a directory and watching for changes in all 
subdirectories. I didn't realize w32notify.c already supported that (the 
filenotify.el docs for "file-notify-add-watch" says "If FILE is a directory, 
`change' watches for file creation or deletion in that directory.  This does 
not work recursively." which made me think none of them do).

> I don't think modules can currently inject events into the Emacs event queue.

Good to know, hand't considered that. This is my first foray into lower level 
Emacs work.

> How would [calls out to an existing program that supports FSEvents like 
> "fswatch"] work, implementation-wise?

I hadn't considered that Lisp can't inject the events into the input queue. My 
thought was to just read the file changes line by line over stdout and then 
feed the events into wherever they need to go.

Muir

On Thu, Jul 18, 2019, at 2:36 AM, Eli Zaretskii wrote:
> > Date: Tue, 16 Jul 2019 21:18:29 -0700
> > From: "Muir Manders" <address@hidden>
> > 
> > I am interested in adding support in Emacs for Mac OS "FSEvents" file 
> > watching. FSEvents allows for
> > efficient recursive directory watching, which would be a boon for packages 
> > like lsp-mode.
> > 
> > I seem to have three options:
> > 
> > 1. Write a new backend for filenotify.el. The existing backends explicitly 
> > don't support recursive watching, so
> > I'm not sure if it makes sense to have one special backend that does 
> > support recursive watching.
> 
> What do you mean by "recursive watching"?  w32notify.c supports
> watching changes in all the subdirectories, recursively, of a
> specified directory.  Is that what you mean?
> 
> > 2. Publish a dynamic module that wraps the FSEvents API. It seems like most 
> > OSX distributions of Emacs
> > have module support enabled, but I'm afraid there might be other challenges 
> > with this approach I don't know
> > yet.
> 
> I don't think modules can currently inject events into the Emacs event
> queue.
> 
> > 3. Publish an elisp package that calls out to an existing program that 
> > supports FSEvents like "fswatch". This
> > approach probably has the least friction, but doesn't allow for tweaking 
> > FSEvents settings, and might have
> > performance disadvantages.
> 
> How would that work, implementation-wise?  Filesystem events are
> supposed to be eventually injected into the input queue; how would you
> go about doing that when an external porgram does the watching?
>



reply via email to

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