Re: [code] Hook to the save event

From: Mitchell <m.att.foicica.com>
Date: Sun, 18 Nov 2012 17:36:58 -0500 (EST)

Hi,

On Sun, 18 Nov 2012, Robert wrote:

> Hi,
>
> the official Ruby[1] and Python [2] have after save events that you
> could use as a starting point.
> Something like this could work for you:
>
> events.connect(events.FILE_AFTER_SAVE, function()
> if buffer:get_lexer() == 'hypertext' then
> -- set ftp settings according to filename
> -- ...
> local ftp_command = ...
> local p = io.popen(ftp_command .. '2>&1')
> end
> end)
>
> Note that this is blocking, so it might be less useful if your ftp
> syncing is slow.

You can use the spawn module for non-blocking processes:

   http://foicica.com/wiki/lspawn

Mitchell

-- 
You are subscribed to code.att.foicica.com.
To change subscription settings, send an e-mail to code+help.att.foicica.com.
To unsubscribe, send an e-mail to code+unsubscribe.att.foicica.com.
Received on Sun 18 Nov 2012 - 17:36:58 EST

This archive was generated by hypermail 2.2.0 : Mon 19 Nov 2012 - 06:52:43 EST