Commits

ZyX_I committed 56aa4e6

Some minor changes

  • Participants
  • Parent commits b568664

Comments (0)

Files changed (2)

File doc/frawor.txt

         that you should not unload plugin/frawor/functions because it is 
         required for other plugins to be unloaded correctly.
                                                     *frawor-f-addextfunctions*
-addextfunctions : function ({ {funcname}: {funcdescr} })
+addextfunctions : function ({ {funcname}: {funcdescr} }) + s:F._functions
         Defined in plugin/frawor/functions plugin. Adds external functions and 
         puts them into s:F._functions. If plugin that calls this feature is not 
         yet loaded, |FuncUndefined| events will be created instead of functions. 

File plugin/frawor.vim

 let s:g.f.load.newfeature=s:g.features.newfeature
 let s:g.f.unload.newfeature=s:g.features.newfeature
 function s:g.features.newfeature.cons(plugdict, fid, fopts)
+    "▶2 Check arguments
     if type(a:fid)!=type("")
         call s:F._frawor.throw('fidnotstr', a:plugdict.id)
     elseif empty(a:fid) || a:fid=~#'\W'
     elseif type(a:fopts)!=type({})
         call s:F._frawor.throw('foptsnotdct', a:fid, a:plugdict.id)
     endif
-    let feature={}
-    let feature.plid=a:plugdict.id
-    let feature.id=a:fid
+    "▲2
+    let feature={
+                \'plid': a:plugdict.id,
+                \  'id': a:fid,
+            \}
+    "▶2 Adding keys that hold functions
     let addedsomething=0
     for key in s:g.featfunckeys
         if has_key(a:fopts, key)
             let addedsomething=1
         endif
     endfor
+    "▶3 Must have added something
     if !addedsomething
         call s:F._frawor.throw('nofeatkeys', feature.id, feature.plid)
     endif
+    "▶2 Adding `ignoredeps'
     if has_key(a:fopts, 'ignoredeps')
         let feature.ignoredeps=1
     endif
-    if has_key(a:fopts, 'init')
+    "▶2 Adding `init'
+    if has_key(a:fopts, 'init') && !has_key(feature, 'load')
         let feature.init=a:fopts.init
         let s:g.f.load[feature.id]=feature
     endif
+    "▲2
     let a:plugdict.features.newfeature[feature.id]=feature
     let s:g.features[feature.id]=feature
+    "▶2 Running addfeature() and register()
+    " FIXME test it
+    " XXX We do not actuall want a list, just missing comma operator
     if has_key(feature, 'ignoredeps')
-        call map(values(s:g.pls), 's:F.addfeature(v:val, feature)'.
-                    \             ((has_key(feature, 'register'))?
-                    \               ('+feature.register(v:val)'):
-                    \               ('')))
+        call map(values(s:g.pls), '[s:F.addfeature(v:val, feature)'.
+                    \               ((has_key(feature, 'register'))?
+                    \                   (', feature.register(v:val)]'):
+                    \                   (']')))
     elseif has_key(s:g.dependents, a:plugdict.id)
         call map(keys(s:g.dependents[a:plugdict.id]),
-                    \'s:F.addfeature(s:g.pls[v:val], feature)'.
-                    \((has_key(feature, 'register'))?
-                    \   ('+feature.register(s:g.pls[v:val])'):
-                    \   ('')))
+                    \'[s:F.addfeature(s:g.pls[v:val], feature)'.
+                    \ ((has_key(feature, 'register'))?
+                    \   (', feature.register(s:g.pls[v:val])]'):
+                    \   (']')))
     endif
 endfunction
 "▶1 features.newfeature.unload