If you want something to happen on each save regardless whether it was 
initiated by hitting Ctrl-s or by auto-save, the best approach would be to 
register a callback on 'save2' event which fires after any save. For 
example:

from collections import Counter
counter = Counter()
def activate():
    c.user_dict['my_callback'] = my_callback
    g.registerHandler('save2', my_callback)


def deactivate():
    h = c.user_dict.pop('my_callback', None)
    if h:
        g.unregisterHandler('save2', h)


def my_callback(tag, kw):
    c = kw.get('c')
    counter[c.mFileName] += 1
    g.es('git commit -a -m "version %d"'%counter[c.mFileName]) # do whatever

activate() # or deactivate()

Of course, you would use some method to actually run git command in the 
right folder instead of writing to Log pane.

HTH Vitalije


-- 
You received this message because you are subscribed to the Google Groups 
"leo-editor" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/leo-editor/987a1acf-f8d6-44cb-b821-f5b21f73979e%40googlegroups.com.

Reply via email to