Skip to content

Commit

Permalink
show all possible config files for -vf (cf. #60)
Browse files Browse the repository at this point in the history
  • Loading branch information
wtsnjp committed Feb 28, 2021
1 parent 7b1b6ab commit c6186ec
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 10 deletions.
13 changes: 6 additions & 7 deletions script/texdoclib-config.tlu
Expand Up @@ -274,15 +274,15 @@ local function get_config_files()
}

-- get dirs
local sep = (os.type == 'windows') and ';' or ':'
local texmf_texdoc = kpse.expand_path('$TEXMF/texdoc')
local dirs = texmf_texdoc:explode(sep)
local kpse_texmf = kpse.expand_var('$TEXMF')
local texmfs = kpse.expand_braces(kpse_texmf):explode(C.kpse_sep)

-- merge them
local ret = {}
for _, dir in ipairs(dirs) do
for _, dir in ipairs(texmfs) do
local path = dir:gsub('^!!', '')
for _, name in ipairs(names) do
local pathname = dir .. '/' .. name
local pathname = path .. '/texdoc/' .. name
table.insert(ret, pathname)
end
end
Expand Down Expand Up @@ -344,9 +344,8 @@ function M.show_config_files(is_action)
-- show the recommendation (only for the "files" action)
if is_action then
print_func('Recommended file(s) for personal settings:')
local sep = (os.type == 'windows') and ';' or ':'
-- here TEXMFHOMEs do not have to exist, and thus use kpse.var_value
local texmfhomes = string.explode(kpse.var_value('TEXMFHOME'), sep)
local texmfhomes = kpse.var_value('TEXMFHOME'):explode(C.kpse_sep)
for _, home in ipairs(texmfhomes) do
print_func(indent .. w32_path(home .. '/texdoc/texdoc.cnf'))
end
Expand Down
4 changes: 4 additions & 0 deletions script/texdoclib-const.tlu
Expand Up @@ -5,6 +5,7 @@
-- use an empty environment that will become texdoc_env.C (see EOF)
local constants = {}
local kpse = kpse or require 'kpse'
local os = os or require 'os'
local setfenv = setfenv
local texdoc_env

Expand Down Expand Up @@ -133,6 +134,9 @@ data_tlpdb_name = 'texdoc/Data.tlpdb.lua'

place_holder = '%%s' -- used for viewer commands

-- kpse path separator
kpse_sep = (os.type == 'windows') and ';' or ':'

-- END constants

-- get our previous environment back
Expand Down
5 changes: 2 additions & 3 deletions script/texdoclib-search.tlu
Expand Up @@ -280,7 +280,7 @@ local function scan_db(patlist, code, lsr_db)
end
end
--------------------- manage TEXDOCS trees à la kpse ----------------------
--------------------- manage TEXDOCS trees of the kpse ----------------------
-- build a db from a ls-R file
local function init_lsr_db(root, shift)
Expand Down Expand Up @@ -371,11 +371,10 @@ init_texdocs_database = function()
end
doc_roots = {}
local sep = (os.type == 'windows') and ';' or ':'
local kpse_texdocs = kpse.expand_var('$TEXDOCS')
-- expand the path and turn it into a lua list
local raw_doc_roots = kpse.expand_braces(kpse_texdocs):explode(sep)
local raw_doc_roots = kpse.expand_braces(kpse_texdocs):explode(C.kpse_sep)
local max = #raw_doc_roots + 1
for j, dir in ipairs(raw_doc_roots) do
Expand Down

0 comments on commit c6186ec

Please sign in to comment.