Commits

ZyX_I  committed 84f8382

@aurum/cache, @%aurum: Moved getcrf to @%aurum

  • Participants
  • Parent commits 395e46d
  • Branches movetoautoload

Comments (0)

Files changed (2)

File autoload/aurum.vim

 "▶1 
 execute frawor#Setup('0.1', {'@aurum/repo': '4.0',
-            \               '@aurum/cache': '1.0',})
+            \               '@aurum/cache': '1.0',
+            \            '@aurum/cmdutils': '3.0',})
+"▶1 getcrf
+function s:F.getcrf()
+    let buf=bufnr('%')
+    if !has_key(s:_r.cache.cachebvars, buf)
+        let cbvar={}
+    endif
+    let cbvar=s:_r.cache.cachebvars[buf]
+    if has_key(cbvar, '__relfname') && has_key(cbvar, 'repo') &&
+                \localtime()-cbvar._timerepo<cbvar._maxtimerepo
+        return [cbvar, cbvar.repo, cbvar.__relfname]
+    endif
+    try
+        silent let [hasbuf, repo, rev, file]=s:_r.cmdutils.getrrf({'repo': ':'},
+                    \                                             0,"getsilent")
+    catch /^Frawor:[^:]\+:nrepo:/
+        return [cbvar, 0, 0]
+    endtry
+    if repo isnot 0 && file isnot 0
+        let cbvar.repo=repo
+        let cbvar._timerepo=localtime()
+        let cbvar._maxtimerepo=s:_f.getoption('repocachetime')
+        let cbvar.__relfname=file
+    endif
+    return [cbvar, repo, file]
+endfunction
 "▶1 aurum#repository
 function aurum#repository()
     let repo=s:_r.cache.get('repo', s:_r.repo.get, [':'], {})
 let s:_functions+=['aurum#changeset']
 "▶1 aurum#status
 function aurum#status(...)
-    let [cbvar, repo, file]=s:_r.cache.getcrf()
+    let [cbvar, repo, file]=s:F.getcrf()
     if repo is 0 || file is 0
         return ''
     endif

File plugin/aurum/cache.vim

 scriptencoding utf-8
 if !exists('s:_pluginloaded')
     execute frawor#Setup('1.0', {'@/resources': '0.0',
-                \                  '@/options': '0.0',
-                \            '@aurum/cmdutils': '3.0',}, 0)
+                \                  '@/options': '0.0',}, 0)
     finish
 elseif s:_pluginloaded
     finish
     autocmd BufWipeOut,BufFilePost * :call s:F.bufwipeout()
 augroup END
 let s:_augroups+=['AurumCacheBufVars']
-"▶1 getcrf
-function s:F.getcrf()
-    let buf=bufnr('%')
-    if !has_key(s:cachebvars, buf)
-        let cbvar={}
-    endif
-    let cbvar=s:cachebvars[buf]
-    if has_key(cbvar, '__relfname') && has_key(cbvar, 'repo') &&
-                \localtime()-cbvar._timerepo<cbvar._maxtimerepo
-        return [cbvar, cbvar.repo, cbvar.__relfname]
-    endif
-    try
-        silent let [hasbuf, repo, rev, file]=s:_r.cmdutils.getrrf({'repo': ':'},
-                    \                                             0,"getsilent")
-    catch /^Frawor:[^:]\+:nrepo:/
-        return [cbvar, 0, 0]
-    endtry
-    if repo isnot 0 && file isnot 0
-        let cbvar.repo=repo
-        let cbvar._timerepo=localtime()
-        let cbvar._maxtimerepo=s:_f.getoption('repocachetime')
-        let cbvar.__relfname=file
-    endif
-    return [cbvar, repo, file]
-endfunction
 "▶1 getcachedval :: key, func, args, dict → val + cbvar
 function s:F.getcachedval(key, Func, args, dict)
     let buf=bufnr('%')
 "▶1 Post cache resource
 call s:_f.postresource('cache', {'get': s:F.getcachedval,
             \                    'del': s:F.delcachedval,
-            \                    'getcrf': s:F.getcrf,})
+            \             'cachebvars': s:cachebvars,})
 "▶1
 call frawor#Lockvar(s:, '_pluginloaded,cachebvars')
 " vim: ft=vim ts=4 sts=4 et fmr=▶,▲