Commits

ZyX_I  committed c2967c9

core: fixed registration of twoload plugins when feature is defined after plugin is registered
Made @/base64 and @/table plugins twoload

  • Participants
  • Parent commits 3260979

Comments (0)

Files changed (8)

File plugin/frawor.vim

         call s:F.addcons(plugdict)
     endif
 endfunction
-"▶1 addfeature      :: plugdict, feature(ircl) + shadowdict → + shadowdict
-function s:F.addfeature(plugdict, feature)
+"▶1 addfeature      :: plugdict, feature(ircl)[, load] → + shadowdict
+function s:F.addfeature(plugdict, feature, ...)
     let shadowdict=s:shadow[a:plugdict.id]
     "▶2 `init' and `register' keys
     if !has_key(shadowdict.features, a:feature.id)
     endif
     "▶2 `load' key
     if has_key(a:feature, 'load') && !has_key(shadowdict.loadedfs, a:feature.id)
+                \&& ((a:0 && a:1) || a:plugdict.status==2)
         call a:feature.load(a:plugdict, shadowdict.features[a:feature.id])
         let shadowdict.loadedfs[a:feature.id]=1
     endif
             for feature in sort(values(s:features), function('s:FeatComp'))
                 if has_key(plugdict.dependencies, feature.plid) ||
                             \has_key(feature, 'ignoredeps')
-                    call s:F.addfeature(plugdict, feature)
+                    call s:F.addfeature(plugdict, feature, 1)
                 endif
             endfor
             "▲2
             "▶2 Adding features to already loaded plugins
             if has_key(shadowdict.features, 'newfeature')
                 for feature in values(shadowdict.features.newfeature)
-                    call map(filter(((has_key(feature, 'ignoredeps'))?
+                    call map(((has_key(feature, 'ignoredeps'))?
                                 \       (values(s:pls)):
                                 \       (map(keys(get(s:dependents,
                                 \                     plugdict.id, {})),
                                 \            's:pls[v:val]'))),
-                                \   'v:val.status==2'),
                                 \'s:F.addfeature(v:val, feature)')
                 endfor
             endif
     let a:fdict[feature.id]=feature
     let s:features[feature.id]=feature
     "▶2 Running addfeature()
-    call map(filter(((has_key(feature, 'ignoredeps'))?
+    call map(((has_key(feature, 'ignoredeps'))?
                 \(values(s:pls)):
                 \((has_key(s:dependents, a:plugdict.id))?
                 \   (map(keys(get(s:dependents, a:plugdict.id, {})),
                 \        's:pls[v:val]')):
-                \   ([]))), 'v:val.status==2'),
+                \   ([]))),
                 \'s:F.addfeature(v:val, feature)')
 endfunction
 "▶1 features.newfeature.unload :: {f} → + s:features, shadowdict, s:f

File plugin/frawor/base64.vim

 "▶1 Header
 scriptencoding utf-8
-execute frawor#Setup('0.0', {'@/resources': '0.0'}, 1)
+if !exists('s:_pluginloaded')
+    execute frawor#Setup('0.0', {'@/resources': '0.0'}, 0)
+    finish
+elseif s:_pluginloaded
+    finish
+endif
 let s:F.base64={}
 "▶1 and           :: UInt, UInt → UInt
 function s:F.and(v1, v2)
 "▶1 post resource
 call s:_f.postresource('base64', s:F.base64)
 "▶1
-call frawor#Lockvar(s:, '')
+call frawor#Lockvar(s:, '_pluginloaded')
 " vim: fmr=▶,▲ sw=4 ts=4 sts=4 et tw=80

File plugin/frawor/table.vim

 "▶1 Header
 scriptencoding utf-8
-execute frawor#Setup('0.0', {'@/resources': '0.0'}, 1)
+if !exists('s:_pluginloaded')
+    execute frawor#Setup('0.0', {'@/resources': '0.0'}, 0)
+    finish
+elseif s:_pluginloaded
+    finish
+endif
 "▶1 strdisplaywidth  :: String, column → UInt
 if exists('*strdisplaywidth')
     let s:F.strdisplaywidth=function('strdisplaywidth')
 "▶1 Register resource
 call s:_f.postresource('printtable', s:F.printtable)
 "▶1
-call frawor#Lockvar(s:, '')
+call frawor#Lockvar(s:, '_pluginloaded')
 " vim: fmr=▶,▲ sw=4 ts=4 sts=4 et tw=80

File test/ignoredeps-feature.ok

 register: plugin/frawor/autocommands
 load: plugin/frawor/autocommands
 register: plugin/frawor/table
-load: plugin/frawor/table
 register: plugin/frawor/checks
 load: plugin/frawor/checks
 register: plugin/frawor/lua
 register: plugin/frawor/fwc/topconstructs
 load: plugin/frawor/fwc/topconstructs
 register: plugin/frawor/base64
-load: plugin/frawor/base64
 register: plugin/frawor/python
 load: plugin/frawor/python
 register: plugin/frawor/functions

File test/reload-frawor.ok

 register: plugin/frawor/autocommands
 load: plugin/frawor/autocommands
 register: plugin/frawor/table
-load: plugin/frawor/table
 register: plugin/frawor/checks
 load: plugin/frawor/checks
 register: plugin/frawor/lua
 register: plugin/frawor/fwc/topconstructs
 load: plugin/frawor/fwc/topconstructs
 register: plugin/frawor/base64
-load: plugin/frawor/base64
 register: plugin/frawor/python
 load: plugin/frawor/python
 register: plugin/frawor/functions
 register: plugin/frawor/tcl
 load: plugin/frawor/tcl
 register: plugin/frawor/table
-load: plugin/frawor/table
 register: plugin/frawor/ruby
 load: plugin/frawor/ruby
 register: plugin/frawor/python
 load: plugin/frawor/functions
 register: plugin/frawor/commands
 load: plugin/frawor/commands
-register: plugin/frawor/base64
-load: plugin/frawor/base64
+register: plugin/frawor/base64

File test/reload-ignoredeps.ok

 register: plugin/frawor/autocommands
 load: plugin/frawor/autocommands
 register: plugin/frawor/table
-load: plugin/frawor/table
 register: plugin/frawor/checks
 load: plugin/frawor/checks
 register: plugin/frawor/lua
 register: plugin/frawor/fwc/topconstructs
 load: plugin/frawor/fwc/topconstructs
 register: plugin/frawor/base64
-load: plugin/frawor/base64
 register: plugin/frawor/python
 load: plugin/frawor/python
 register: plugin/frawor/functions
 register: plugin/frawor/autocommands
 load: plugin/frawor/autocommands
 register: plugin/frawor/table
-load: plugin/frawor/table
 register: plugin/frawor/checks
 load: plugin/frawor/checks
 register: plugin/frawor/lua
 register: plugin/frawor/fwc/topconstructs
 load: plugin/frawor/fwc/topconstructs
 register: plugin/frawor/base64
-load: plugin/frawor/base64
 register: plugin/frawor/python
 load: plugin/frawor/python
 register: plugin/frawor/functions

File test/reload-writefile.ok

 register: plugin/frawor/autocommands
 load: plugin/frawor/autocommands
 register: plugin/frawor/table
-load: plugin/frawor/table
 register: plugin/frawor/checks
 load: plugin/frawor/checks
 register: plugin/frawor/lua
 register: plugin/frawor/fwc/topconstructs
 load: plugin/frawor/fwc/topconstructs
 register: plugin/frawor/base64
-load: plugin/frawor/base64
 register: plugin/frawor/python
 load: plugin/frawor/python
 register: plugin/frawor/functions
 register: plugin/frawor/autocommands
 load: plugin/frawor/autocommands
 register: plugin/frawor/table
-load: plugin/frawor/table
 register: plugin/frawor/checks
 load: plugin/frawor/checks
 register: plugin/frawor/lua
 register: plugin/frawor/fwc/topconstructs
 load: plugin/frawor/fwc/topconstructs
 register: plugin/frawor/base64
-load: plugin/frawor/base64
 register: plugin/frawor/python
 load: plugin/frawor/python
 register: plugin/frawor/functions

File test/unload-self.ok

 register: plugin/frawor/autocommands
 load: plugin/frawor/autocommands
 register: plugin/frawor/table
-load: plugin/frawor/table
 register: plugin/frawor/checks
 load: plugin/frawor/checks
 register: plugin/frawor/lua
 load: plugin/frawor/fwc/parser
 register: plugin/frawor
 load: plugin/frawor
+register: plugin/unload-self
 register: plugin/frawor/decorators
 load: plugin/frawor/decorators
 register: plugin/frawor/mappings
 register: plugin/unload-self-feature
 load: plugin/unload-self-feature
 register: plugin/frawor/base64
-load: plugin/frawor/base64
 register: plugin/frawor/python
 load: plugin/frawor/python
 register: plugin/frawor/functions
 load: plugin/frawor/tcl
 register: plugin/writefile-feature
 load: plugin/writefile-feature
-register: plugin/unload-self
 load: plugin/unload-self
 unloadpre: plugin/unload-self
 unload: plugin/unload-self