From e904799d684fdb05dd16b69092f50cfa883a67f6 Mon Sep 17 00:00:00 2001 From: Alan Hamlett Date: Tue, 25 Jun 2013 22:58:13 -0700 Subject: [PATCH] fixed bugs in function s:allServersAway(). preventing action sent when editor first opened without file. --- plugin/wakatime.vim | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/plugin/wakatime.vim b/plugin/wakatime.vim index 7e6351b..6900c53 100644 --- a/plugin/wakatime.vim +++ b/plugin/wakatime.vim @@ -88,11 +88,15 @@ function! s:GetCurrentFile() endfunction function! s:api(type, task) - exec "silent !python " . s:plugin_directory . "/wakatime.py --key" g:wakatime_api_key "--instance" s:instance_id "--action" a:type "--task" shellescape(a:task) . " &" + if a:task != '' + exec "silent !python " . s:plugin_directory . "/wakatime.py --key" g:wakatime_api_key "--instance" s:instance_id "--action" a:type "--task" shellescape(a:task) . " &" + endif endfunction function! s:api_with_time(type, task, time) - exec "silent !python " . s:plugin_directory . "/wakatime.py --key" g:wakatime_api_key "--instance" s:instance_id "--action" a:type "--task" shellescape(a:task) "--time" printf("%f", a:time) . " &" + if a:task != '' + exec "silent !python " . s:plugin_directory . "/wakatime.py --key" g:wakatime_api_key "--instance" s:instance_id "--action" a:type "--task" shellescape(a:task) "--time" printf("%f", a:time) . " &" + endif endfunction function! s:getchar() @@ -103,7 +107,7 @@ function! s:getchar() return c endfunction -function! s:isAway() +function! Wakatime_isAway() return s:away_start endfunction @@ -111,8 +115,10 @@ function! s:allServersAway() if has('clientserver') let servers = split(serverlist()) for server in servers - if !remote_expr(server,'s:isAway()') - return 0 + if server != v:servername + if !remote_expr(server,'Wakatime_isAway()') + return 0 + endif endif endfor endif