diff options
Diffstat (limited to 'Master')
-rw-r--r-- | Master/texmf-dist/scripts/texdoc/config.tlu | 33 |
1 files changed, 27 insertions, 6 deletions
diff --git a/Master/texmf-dist/scripts/texdoc/config.tlu b/Master/texmf-dist/scripts/texdoc/config.tlu index 25d64617831..ea4acbb4564 100644 --- a/Master/texmf-dist/scripts/texdoc/config.tlu +++ b/Master/texmf-dist/scripts/texdoc/config.tlu @@ -189,18 +189,39 @@ function setup_config_from_env () end end end + local function set_config_elt_from_option_env(key, var) + if (os.type == "windows") then return end + local value = os.getenv(var) + if value then + for cmd in string.gmatch(value, '([^:]+)') do + if is_in_path(cmd) then + set_config_element(key, cmd, {src='env', name=var}) + -- don't test other commands if we have found one + break + end + end + end + end set_config_elt_from_vars('viewer_pdf', - {"PDFVIEWER_texdoc", "TEXDOCVIEW_pdf", "TEXDOC_VIEWER_PDF", "PDFVIEWER"}) + {"PDFVIEWER_texdoc", "TEXDOCVIEW_pdf", "TEXDOC_VIEWER_PDF"}) + set_config_elt_from_option_env('viewer_pdf', "PDFVIEWER") set_config_elt_from_vars('viewer_ps', - {"PSVIEWER_texdoc", "TEXDOCVIEW_ps", "TEXDOC_VIEWER_PS", "PSVIEWER"}) + {"PSVIEWER_texdoc", "TEXDOCVIEW_ps", "TEXDOC_VIEWER_PS"}) + set_config_elt_from_option_env('viewer_ps', "PSVIEWER") set_config_elt_from_vars('viewer_dvi', - {"DVIVIEWER_texdoc", "TEXDOCVIEW_dvi", "TEXDOC_VIEWER_DVI", "DVIVIEWER"}) + {"DVIVIEWER_texdoc", "TEXDOCVIEW_dvi", "TEXDOC_VIEWER_DVI"}) + set_config_elt_from_option_env('viewer_dvi', "DVIVIEWER") set_config_elt_from_vars('viewer_html', - {"BROWSER_texdoc", "TEXDOCVIEW_html", "TEXDOC_VIEWER_HTML", "BROWSER"}) + {"BROWSER_texdoc", "TEXDOCVIEW_html", "TEXDOC_VIEWER_HTML"}) + set_config_elt_from_option_env('viewer_html', "BROWSER") + bla = config['viewer_html'] + err_print('warning', 'NORBERT: viewer_html is now ' .. bla) set_config_elt_from_vars('viewer_md', - {"MDVIEWER_texdoc", "TEXDOCVIEW_md", "TEXDOC_VIEWER_MD", "PAGER"}) + {"MDVIEWER_texdoc", "TEXDOCVIEW_md", "TEXDOC_VIEWER_MD"}) + set_config_elt_from_option_env('viewer_md', "PAGER") set_config_elt_from_vars('viewer_txt', - {"PAGER_texdoc", "TEXDOCVIEW_txt", "TEXDOC_VIEWER_TXT", "PAGER"}) + {"PAGER_texdoc", "TEXDOCVIEW_txt", "TEXDOC_VIEWER_TXT"}) + set_config_elt_from_option_env('viewer_txt', "PAGER") end ---------------------- options and aliases from files ---------------------- |