From a667d88a9dc5a27597b089cc618e1e8715c3f970 Mon Sep 17 00:00:00 2001 From: LCD 47 Date: Mon, 6 Jan 2014 19:44:28 +0200 Subject: [PATCH] A better mousetrap for bitwise functions. --- autoload/syntastic/log.vim | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/autoload/syntastic/log.vim b/autoload/syntastic/log.vim index 8b7281ea..4a53df14 100644 --- a/autoload/syntastic/log.vim +++ b/autoload/syntastic/log.vim @@ -129,11 +129,17 @@ endfunction " Private functions {{{1 -function! s:isDebugEnabled(level) +function! s:isDebugEnabled_smart(level) + return and(g:syntastic_debug, a:level) +endfunction + +function! s:isDebugEnabled_dumb(level) " poor man's bit test for bit N, assuming a:level == 2**N return (g:syntastic_debug / a:level) % 2 endfunction +let s:isDebugEnabled = function(exists('*and') ? 's:isDebugEnabled_smart' : 's:isDebugEnabled_dumb') + function! s:logRedirect(on) if exists("g:syntastic_debug_file") if a:on @@ -149,10 +155,16 @@ function! s:logRedirect(on) endif endfunction -function! s:logTimestamp() - return 'syntastic: ' . ( has('reltime') ? split(reltimestr(reltime(g:syntastic_start)))[0] : 'debug' ) . ': ' +function! s:logTimestamp_smart() + return 'syntastic: ' . split(reltimestr(reltime(g:syntastic_start)))[0] . ': ' endfunction +function! s:logTimestamp_dumb() + return 'syntastic: debug: ' +endfunction + +let s:logTimestamp = function(has('reltime') ? 's:logTimestamp_smart' : 's:logTimestamp_dumb') + function! s:formatVariable(name) let vals = [] if exists('g:' . a:name)