Warning: this is an htmlized version!
The original is here, and the conversion rules are here. |
#!/usr/bin/env lua5.1 -- This file: -- http://anggtwu.net/LUA/Deps1.lua.html -- http://anggtwu.net/LUA/Deps1.lua -- (find-angg "LUA/Deps1.lua") -- Author: Eduardo Ochs <eduardoochs@gmail.com> -- -- (defun e () (interactive) (find-angg "LUA/Deps1.lua")) -- -- Based on: (find-angg ".emacs.templates" "find-cp-LUA-links") -- Try: (find-sh0 "~/LUA/Deps1.lua -runcps Caepro4") -- (find-sh0 "~/LUA/Deps1.lua -runcps 'Caepro4 ELpeg-cme1'") -- (find-estring (find-sh0 "~/LUA/Deps1.lua -findanggs 'Caepro4 ELpeg-cme1'")) -- «.run_options» (to "run_options") Deps = Class { type = "Deps", from = function (mains) local s1 = Set.from(split(mains)) local s2 = Set.from(keys(package.loaded)) local s3 = Set.from(split("lpeg re")) return Deps {mains=mains, s1=s1, s2=s2, s3=s3} end, __index = { load = function (d) Path.prependtopath "~/LUA/?.lua" for _,name in ipairs(split(d.mains)) do require(name) end local s4 = Set.from(keys(package.loaded)) d.s4 = s4 return d end, cps = function (d, s, fmt) s = s or (d.s4 - d.s3 - d.s2) fmt = fmt or "cp -v ~/LUA/%s.lua ~/LATEX/" local f = function (name) return format(fmt, name) end return mapconcat(f, s:ks(), "\n") end, cpsto = function (d, s, dir) return d:cps(d, "cp -v ~/LUA/%s.lua "..dir) end, runcps = function (d, ...) return getoutput(d:cps(...)) end, runcpsto = function (d, ...) return getoutput(d:cpsto(...)) end, findanggs = function (d, s) return d:cps(s, '-- (find-angg "LUA/%s.lua")') end, listfiles = function (d, s) return d:cps(s, '%s.lua') end, }, } --[[ * (eepitch-lua51) * (eepitch-kill) * (eepitch-lua51) dofile "Deps1.lua" d = Deps.from("Caepro4"):load() = d:cps() = d:runcps() s = d.s4 - d.s3 - d.s2 = s:ksc(" ") = VTable(s:ks()) * (eepitch-lua52) * (eepitch-kill) * (eepitch-lua52) dofile "Deps1.lua" run_options("-listfiles", "ParseTikz1") run_options("-runcps", "Caepro4") --]] -- «run_options» (to ".run_options") -- (find-es "lua5" "run_options") run_options = function (a, b) if a == nil then return elseif a == "Deps1" then return elseif a == "-runcps" then print(Deps.from(b):load():runcps()) elseif a == "-findanggs" then print(Deps.from(b):load():findanggs()) elseif a == "-listfiles" then print(Deps.from(b):load():listfiles()) else PP("Bad options:", a, b) end end run_options(...) --[[ * (eepitch-lua51) * (eepitch-kill) * (eepitch-lua51) dofile "Deps1.lua" run_options() run_options("-runcps", "Caepro4") --]] -- Local Variables: -- coding: utf-8-unix -- End: