Commits

ZyX_I  committed 5313663

autoload/frawor: Renamed s:F.expandplid() to frawor#expandplid() and documented it, added @% -> autoload/ expansion

  • Participants
  • Parent commits ebcfecc

Comments (0)

Files changed (3)

File autoload/frawor.vim

     return eval(a:expr)
 endfunction
 let s:_functions['s:Eval']=function('s:Eval')
-"▶1 expandplid     :: String → String
-function s:F.expandplid(str)
+"▶1 frawor#expandplid :: String → String
+function frawor#expandplid(str)
     return substitute(substitute(substitute(substitute(substitute(a:str,
-                \'^@$', 'plugin/frawor',  ''),
-                \'^@@', '@',              ''),
-                \'^@/', 'plugin/frawor/', ''),
-                \'^@:', 'ftplugin/',      ''),
-                \'^@',  'plugin/',        '')
+                \'\m^@@', '@',              ''),
+                \'\m^@/', 'plugin/frawor/', ''),
+                \'\m^@:', 'ftplugin/',      ''),
+                \'\m^@%', 'autoload/',      ''),
+                \'\m^@',  'plugin/',        '')
 endfunction
-"▶1 frawor#Setup   :: version, dependencies, oneload → vimlstr
+"▶1 frawor#Setup      :: version, dependencies, oneload → vimlstr
 function frawor#Setup(version, dependencies, oneload)
     if type(a:version)==type("")
         let ver=map(split(a:version, '\.'), '+v:val')
                 \   '(map(split(v:val, "\\."), "+v:val")):'.
                 \   '(v:val))')
     for key in keys(deps)
-        let deps[s:F.expandplid(key)]=remove(deps, key)
+        let deps[frawor#expandplid(key)]=remove(deps, key)
     endfor
     let dstr=substitute(string(deps), "\n", '''."\\n".''', 'g')
     let oneload=(!!a:oneload)
                 \                                oneload.", s:)"
 endfunction
 let s:_functions['frawor#Setup']=function('frawor#Setup')
-"▶1 frawor#Reload  :: Either plugdict plid → + :source
+"▶1 frawor#Reload     :: Either plugdict plid → + :source
 function! frawor#Reload(plid)
-    for file in FraworUnload(s:F.expandplid(a:plid))
+    for file in FraworUnload(frawor#expandplid(a:plid))
         if file isnot 0
             execute 'source' fnameescape(file)
         endif
     endfor
 endfunction
 let s:_functions['frawor#Reload']=function('frawor#Reload')
-"▶1 frawor#Lockvar :: p:, varnamelist → + :lockvar
+"▶1 frawor#Lockvar    :: p:, varnamelist → + :lockvar
 function frawor#Lockvar(s, nolock)
     let nolock=split(a:nolock, ",")
     for varname in filter(keys(a:s), 'index(nolock, v:val)==-1')

File doc/frawor.txt

            Example: "1.0.4" → [1, 0, 4].
                                                        *frawor-plid-expansion*
         2. If some key in {dependencies} starts with `@', then it is 
-           transformed:
-           Origin      Transformed ~
-           @@          @
-           @/          plugin/frawor/
-           @:          ftplugin/
-           @           plugin/
-           Additionally, if string is equal to `@', then it is expanded to 
-           `plugin/frawor'.
+           transformed, see |frawor#expandplid()|.
         3. It creates s:Eval function which is just a wrapper to |eval()|. 
            Useful inside mappings because they have no direct access to script 
            variables and for obtaining |<SID>| value.
         frawor#Setup extension, it won't work with FraworRegister.
         Note: you must |:execute| frawor#Setup, not |:call| it.
 
+frawor#expandplid({plid})                                *frawor#expandplid()*
+        Perform some expansions on plugin id: if plugin id starts with `@' it 
+        is transformed:
+        Origin      Transformed ~
+        @@          @
+        @/          plugin/frawor/
+        @:          ftplugin/
+        @%          autoload/
+        @           plugin/
+
 FraworLoad({plugin})                                            *FraworLoad()*
         Load {plugin}. {plugin} argument may be either a plugin ID or plugin 
         dictionary. Returns 0 if it failed to load plugin, 1 if plugin was 

File plugin/frawor/fwc/topconstructs.vim

 "   {lvars} :: nextsub, addedsavemsgs
 function s:r.optional.compile(adescr, idx, caidxstr, largsstr, purgemax,
             \                 nextsub, addedsavemsgs)
+    " let hasnext=s:F.hasnext(a:adescr, 'next')
     let addedsavemsgs=a:addedsavemsgs
     " XXX nodefs will be still 1 when compiling next adescr. It is intentional.
     let nodefs=empty(self.defvals)
                         \.addmatches(fsastr, type([]))
         let savedsub=copy(self.subs[-1])
         if noact isnot 0 && len(noact)>1
+            " FIXME This produces much more code then required. Add a way to add 
+            " completion for the first argument only
             call self.compadescr(noact[1], idx.'.nullact')
         endif
         let self.subs[-1]=savedsub