Re: [code] Hook to the save event

From: Robert <rob.g.att.web.de>
Date: Sun, 18 Nov 2012 17:31:43 +0100

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.

Robert

[1] http://foicica.com/hg/ruby/file/bb8cf3d4863f/init.lua#l175
[2] http://foicica.com/hg/python/file/1c3f51fbb50b/init.lua#l159

On Sun, Nov 18, 2012 at 4:44 PM, fedekun <fedekiller.att.gmail.com> wrote:
> Hi! I'm new to TextAdept, it seems like a really nice editor and I'd love to
> use it more on my web development duties, but as it's not as popular as
> Sublime, there are way less plugins, this is cool, but I want to make an FTP
> Sync plugin, I saw the lua api doc, but I coudln't find how to hook on
> certain events, I want to hook on the save event, and upload the file via
> FTP, is this possible?
>
> Thanks in advance.
>
> --
> Best Regards.
> fedekun
>

-- 
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 - 11:31:43 EST

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