Re: [code] [Textadept] SFTP plugin?

From: Ryan P.C. McQuen <>
Date: Fri, 05 May 2017 09:39:47 -0700

—— On Fri, 05 May 2017 09:24:52 -0700 Ryan P.C. McQuen wrote ——

—— On Tue, 25 Apr 2017 16:09:23 -0700 Ryan P.C. McQuen wrote ——

---- On Mon, 24 Apr 2017 14:29:03 -0700 Robert Gieseke &lt;; wrote ----

Am 24/04/17 um 21:58 schrieb Ryan P.C. McQuen:

&gt; That’s awesome! I got |sshfs| going, but how do I make Textadept notify

&gt; me if the file changed remotely?

By default, Textadept checks on the following events whether the

modification time has changed

events_connect(events.BUFFER_AFTER_SWITCH, update_modified_file)

events_connect(events.VIEW_AFTER_SWITCH, update_modified_file)

events_connect(events.FOCUS, update_modified_file)

events_connect(events.RESUME, update_modified_file)

You could maybe periodically check for updates?

I’m now interested in writing a plugin to accomplish this. Looks like timeout() may be used to accomplish something in an interval. Would every 5 or 10 seconds be unreasonable?

Would I just put this in init.lua?

timeout(5, update_modified_file)​

 I should have just tried it. I see that function is local so I had to redefine it, no big deal since it needed to be modified to return true to work as an interval (rather than a timeout). I am testing it out now:
 local function update_modified_file() if not buffer.filename then return true end local mod_time = lfs.attributes(buffer.filename, 'modification') if not mod_time or not buffer.mod_time then return true end if buffer.mod_time &lt; mod_time then buffer.mod_time = mod_time events.emit(events.FILE_CHANGED) end return true end timeout(5, update_modified_file) -Ryan

You are subscribed to
To change subscription settings, send an e-mail to
To unsubscribe, send an e-mail to
Received on Fri 05 May 2017 - 12:39:47 EDT

This archive was generated by hypermail 2.2.0 : Sat 06 May 2017 - 06:40:26 EDT