sent 04:27:32 30 November 2010, Tuesday
by hsitz:
> So thanks to everyone for your suggestions, espcially Marko and ZyX.
> I've posted new version with variable scopes, setting scopes, and
> function scopes cleaned up, and better explanation of how to integrate
> settings in sample vimrc and colorscheme into your own vimrc and
> colorschemes.
some additional notes:
1.
if !exists('g:org_agenda_dirs')
execute "let g:org_agenda_dirs =['".expand("%:p:h")."']"
endif
execute is not required here:
let g:org_agenda_dirs=[expand("%:p:h")]
works just fine and does not break if filename contains newlines.
Same for OrgTagsEdit: if you want to pass unknown number of arguments, use call:
let files=[]
let line_file_args=[]
<...>
call add(files, file)
let line_file_args+=[lineno, file]
<...>
let heading_tags=get(call('s:GetProperties', [lineno, 0]+files), 'tags', '')
<...>
call call('s:SetProp', ['tags', new_heading_tags]+line_file_args)
Same (except note for newlines) for
execute "let b:v.tagdict['" . item . "'] = 1"
silent exe 'normal! dd' -> silent d
execute "normal A ". newd " Forgot «!»
execute 'let @/ ="' . a:term .'"' -> let @/=a:term
execute 'g/' . a:term . '/normal zv' -> g//normal! zv
silent exe '%s/^*x//'
silent exe 'undojoin | %s/^*o//'
purge exe here:
silent %s/^*x//
undojoin
silent %s/^*o//
works just fine.
Review all executes, they are unneeded in most cases and may even cause security
issues.
2. You still have lots of global variables that are not options (though with
org_ prefix). Why don't you like script variables?
No comments:
Post a Comment