texlive[73876] Master/texmf-dist: texdoc (11feb25)

commits+karl at tug.org commits+karl at tug.org
Tue Feb 11 21:48:39 CET 2025


Revision: 73876
          https://tug.org/svn/texlive?view=revision&revision=73876
Author:   karl
Date:     2025-02-11 21:48:39 +0100 (Tue, 11 Feb 2025)
Log Message:
-----------
texdoc (11feb25)

Modified Paths:
--------------
    trunk/Master/texmf-dist/doc/man/man1/texdoc.1
    trunk/Master/texmf-dist/doc/man/man1/texdoc.man1.pdf
    trunk/Master/texmf-dist/doc/support/texdoc/NEWS
    trunk/Master/texmf-dist/doc/support/texdoc/README.md
    trunk/Master/texmf-dist/doc/support/texdoc/texdoc.pdf
    trunk/Master/texmf-dist/doc/support/texdoc/texdoc.tex
    trunk/Master/texmf-dist/scripts/texdoc/texdoclib-alias.tlu
    trunk/Master/texmf-dist/scripts/texdoc/texdoclib-cli.tlu
    trunk/Master/texmf-dist/scripts/texdoc/texdoclib-config.tlu
    trunk/Master/texmf-dist/scripts/texdoc/texdoclib-const.tlu
    trunk/Master/texmf-dist/scripts/texdoc/texdoclib-score.tlu
    trunk/Master/texmf-dist/scripts/texdoc/texdoclib-search.tlu
    trunk/Master/texmf-dist/scripts/texdoc/texdoclib-util.tlu
    trunk/Master/texmf-dist/scripts/texdoc/texdoclib.tlu
    trunk/Master/texmf-dist/texdoc/texdoc.cnf

Modified: trunk/Master/texmf-dist/doc/man/man1/texdoc.1
===================================================================
--- trunk/Master/texmf-dist/doc/man/man1/texdoc.1	2025-02-11 17:36:05 UTC (rev 73875)
+++ trunk/Master/texmf-dist/doc/man/man1/texdoc.1	2025-02-11 20:48:39 UTC (rev 73876)
@@ -1,185 +1,131 @@
-.\" generated with Ronn/v0.7.3
-.\" http://github.com/rtomayko/ronn/tree/0.7.3
-.
-.TH "TEXDOC" "1" "March 2024" "Texdoc 4.1" "Texdoc manual"
-.
+.\" generated with Ronn-NG/v0.10.1
+.\" http://github.com/apjanke/ronn-ng/tree/0.10.1
+.TH "TEXDOC" "1" "February 2025" "Texdoc 4.1.1" "Texdoc manual"
 .SH "NAME"
 \fBtexdoc\fR \- find & view documentation in TeX Live
-.
 .SH "SYNOPSIS"
-\fBtexdoc\fR [OPTION]\.\.\. NAME\.\.\.
-.
+\fBtexdoc\fR [OPTION]\|\.\|\.\|\. NAME\|\.\|\.\|\.
 .br
-\fBtexdoc\fR [OPTION]\.\.\. ACTION
-.
+\fBtexdoc\fR [OPTION]\|\.\|\.\|\. ACTION
 .SH "DESCRIPTION"
 Try to find appropriate TeX documentation for the specified NAME(s)\. Alternatively, perform the given ACTION and exit\.
-.
 .SH "OPTIONS"
-.
 .TP
 \fB\-w\fR, \fB\-\-view\fR
 Use view mode: start a viewer\. \fB(default)\fR
-.
 .TP
 \fB\-m\fR, \fB\-\-mixed\fR
 Use mixed mode (view or list)\.
-.
 .TP
 \fB\-l\fR, \fB\-\-list\fR
 Use list mode: show a list of results\.
-.
 .TP
 \fB\-s\fR, \fB\-\-showall\fR
 Use showall mode: show also "bad" results\.
-.
 .TP
 \fB\-i\fR, \fB\-\-interact\fR
 Use interactive menus\. \fB(default)\fR
-.
 .TP
 \fB\-I\fR, \fB\-\-nointeract\fR
 Use plain lists, no interaction required\.
-.
 .TP
 \fB\-M\fR, \fB\-\-machine\fR
 Machine\-readable output for lists (implies \-I)\.
-.
 .TP
 \fB\-q\fR, \fB\-\-quiet\fR
 Suppress warnings and most error messages\.
-.
 .TP
 \fB\-v\fR, \fB\-\-verbose\fR
 Print additional information (e\.g\., viewer command)\.
-.
 .TP
 \fB\-D\fR, \fB\-\-debug\fR
 Activate all debug output (equal to "\-\-debug=all")\.
-.
 .TP
 \fB\-d\fR LIST, \fB\-\-debug\fR=LIST
 Activate debug output restricted to the categories specified in LIST\.
-.
 .br
-Available categories: \fBconfig\fR, \fBfiles\fR, \fBsearch\fR, \fBscore\fR, \fBtexdocs\fR, \fBtlpdb\fR, \fBversion\fR, \fBview\fR, and \fBall\fR to activate all of these\.
-.
+Available categories: \fBconfig\fR, \fBfiles\fR, \fBsearch\fR, \fBdocfile\fR, \fBscore\fR, \fBtexdocs\fR, \fBtlpdb\fR, \fBversion\fR, \fBview\fR, and \fBall\fR to activate all of these\.
 .TP
 \fB\-c\fR NAME=VALUE
 Set configuration item NAME to VALUE\.
-.
 .SH "ACTIONS"
-.
 .TP
 \fB\-h\fR, \fB\-\-help\fR
 Print this help message\.
-.
 .TP
 \fB\-V\fR, \fB\-\-version\fR
 Print the version number\.
-.
 .TP
 \fB\-f\fR, \fB\-\-files\fR
 Print the list of configuration files used\.
-.
 .TP
 \fB\-\-just\-view\fR FILE
 Display FILE, given with full path (no searching)\.
-.
 .TP
 \fB\-\-print\-completion\fR SHELL
 Print SHELL completion\.
-.
 .SH "ENVIRONMENT"
 The following environment variables can be split by colon and used to set viewers:
-.
 .TP
 \fBBROWSER\fR, \fBBROWSER_texdoc\fR
 Set the command to be used for HTML documents\.
-.
 .TP
 \fBDVIVIEWER\fR, \fBDVIVIEWER_texdoc\fR
 Set the command to be used for DVI documents\.
-.
 .TP
 \fBMDVIEWER\fR, \fBMDVIEWER_texdoc\fR
 Set the command to be used for Markdown documents\.
-.
 .TP
 \fBPAGER\fR, \fBPAGER_texdoc\fR
 Set the command to be used for text documents\.
-.
 .TP
 \fBPDFVIEWER\fR, \fBPDFVIEWER_texdoc\fR
 Set the command to be used for PDF documents\.
-.
 .TP
 \fBPSVIEWER\fR, \fBPSVIEWER_texdoc\fR
 Set the command to be used for PS documents\.
-.
 .P
 The following environment variables are also used:
-.
 .TP
 \fBLANG\fR, \fBLC_ALL\fR, \fBLANGUAGE\fR, \fBLANGUAGE_texdoc\fR
 Set the locale, which will influence on the search results\.
-.
 .TP
 \fBTEXDOCS\fR
 In addition to the documents included in the TeX Live database, Texdoc also searches documentation under TEXMF trees specified by the kpathsea variable \fBTEXDOCS\fR\.
-.
 .SH "FILES"
 \fB<texmf>/texdoc/texdoc\.cnf\fR, see output of the \fB\-\-files\fR option\.
-.
 .SH "EXIT STATUS"
 The \fBtexdoc\fR command exists with one of the following values:
-.
 .TP
 0
 Success\.
-.
 .TP
 1
 Internal error\.
-.
 .TP
 2
 Usage error\.
-.
 .TP
 3
 No documentation found\.
-.
 .SH "REPORTING BUGS"
 Report bugs to \fItexdoc at tug\.org\fR\.
-.
 .br
 Texdoc home page: \fIhttp://tug\.org/texdoc/\fR
-.
 .br
 Source: \fIhttps://github\.com/TeX\-Live/texdoc\fR
-.
 .SH "COPYRIGHT"
-Copyright 2008\-2024 Manuel Pe\'gourie\'\-Gonnard, Takuto Asakura, the TeX Live Team\.
-.
+Copyright 2008\-2025 Manuel Pe'gourie'\-Gonnard, Takuto Asakura, the TeX Live Team\.
 .br
 License: GNU GPL version 3 or later \fIhttp://gnu\.org/licenses/gpl\.html\fR\.
-.
 .br
 This is free software: you are free to change and redistribute it\.
-.
 .SH "SEE ALSO"
 The full documentation is maintained as a PDF manual\. The command
-.
 .IP "" 4
-.
 .nf
-
 texdoc texdoc
-.
 .fi
-.
 .IP "" 0
-.
 .P
 should give you access to the complete manual\.

Modified: trunk/Master/texmf-dist/doc/man/man1/texdoc.man1.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/support/texdoc/NEWS
===================================================================
--- trunk/Master/texmf-dist/doc/support/texdoc/NEWS	2025-02-11 17:36:05 UTC (rev 73875)
+++ trunk/Master/texmf-dist/doc/support/texdoc/NEWS	2025-02-11 20:48:39 UTC (rev 73876)
@@ -2,6 +2,13 @@
 ===============
 (This file public domain.)
 
+Version 4.1.1 (2025-02-11)
+--------------------------
+- New debug category "docfile"
+- Improve zsh completion function (by Markus Kurtz)
+- Some bug fixes and improvements
+- Scoring adjustments
+
 Version 4.1 (2024-03-10)
 ========================
 Release for TeX Live 2024.

Modified: trunk/Master/texmf-dist/doc/support/texdoc/README.md
===================================================================
--- trunk/Master/texmf-dist/doc/support/texdoc/README.md	2025-02-11 17:36:05 UTC (rev 73875)
+++ trunk/Master/texmf-dist/doc/support/texdoc/README.md	2025-02-11 20:48:39 UTC (rev 73876)
@@ -104,7 +104,7 @@
 
 ## Copyright and License
 
-Copyright 2008-2024 Manuel Pégourié-Gonnard, Takuto Asakura, the TeX Live Team.
+Copyright 2008-2025 Manuel Pégourié-Gonnard, Takuto Asakura, the TeX Live Team.
 
 This package is distributed under the terms of the GNU General Public License as published by the Free Software Foundation, either [version 3](./COPYING) of the License, or (at your option) any later version.
 

Modified: trunk/Master/texmf-dist/doc/support/texdoc/texdoc.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/support/texdoc/texdoc.tex
===================================================================
--- trunk/Master/texmf-dist/doc/support/texdoc/texdoc.tex	2025-02-11 17:36:05 UTC (rev 73875)
+++ trunk/Master/texmf-dist/doc/support/texdoc/texdoc.tex	2025-02-11 20:48:39 UTC (rev 73876)
@@ -1,6 +1,6 @@
 %#!texfot xelatex
 % Texdoc user manual
-% Copyright 2008-2024 Manuel Pégourié-Gonnard and Takuto Asakura
+% Copyright 2008-2025 Manuel Pégourié-Gonnard and Takuto Asakura
 % distributed under the terms of GPL v3 or later
 \documentclass{texdoc-doc}
 
@@ -8,7 +8,7 @@
 \subtitle{Find \& view documentation in \TL}
 \pkgurl{https://tug.org/texdoc/}
 \author{Manuel Pégourié-Gonnard\and Takuto Asakura}
-\date{v4.1\quad \today}
+\date{v4.1.1\quad \today}
 
 \begin{document}
 
@@ -668,9 +668,9 @@
 
 \begin{confitem}{debug\_list}{\meta{list}}[default: empty]
 Set the list of activated debug categories. Available debug categories are
-|config|, |files|, |search|, |score|, |texdocs|, |tlpdb|, |version|, |view|,
-and |all| to activate all of these. Implies |--verbose|. Debug information are
-printed on standard error.
+|config|, |files|, |search|, |docfile|, |score|, |texdocs|, |tlpdb|, |version|,
+|view|, and |all| to activate all of these. Implies |--verbose|. Debug
+information are printed on standard error.
 \end{confitem}
 
 \begin{confitem}{max\_lines}{\meta{number}}[default: \code{10}]
@@ -795,7 +795,7 @@
 \label{sec:licence}
 
 The current version of Texdoc program and its documentation are copyright
-2008--2024 Manuel Pégourié-Gonnard, Takuto Asakura, the {\TL} Team.
+2008--2025 Manuel Pégourié-Gonnard, Takuto Asakura, the {\TL} Team.
 
 They are free software: you can redistribute it and/or modify it under the
 terms of the GNU General Public License as published by the Free Software

Modified: trunk/Master/texmf-dist/scripts/texdoc/texdoclib-alias.tlu
===================================================================
--- trunk/Master/texmf-dist/scripts/texdoc/texdoclib-alias.tlu	2025-02-11 17:36:05 UTC (rev 73875)
+++ trunk/Master/texmf-dist/scripts/texdoc/texdoclib-alias.tlu	2025-02-11 20:48:39 UTC (rev 73876)
@@ -46,7 +46,7 @@
 
 -- add an alias value for a key
 local function add_alias(key, value, score)
-    local k = string.lower(key)
+    local k = key:lower()
     alias[k] = alias[k] or {make_alias(key, false)}
     if alias[k].stop then return end
     table.insert(alias[k], make_alias(value, score))
@@ -54,7 +54,7 @@
 
 -- prevent a key from being further aliased
 local function stop_alias(key)
-    local k = string.lower(key)
+    local k = key:lower()
     alias[k] = alias[k] or {}
     alias[k].stop = true
 end
@@ -61,7 +61,7 @@
 
 -- get patterns for a name
 function M.get_patterns(name, no_alias)
-    local n = string.lower(name)
+    local n = name:lower()
 
     -- get normal aliases
     local res
@@ -92,14 +92,13 @@
 -- interpret a confline as an alias setting or return false
 function M.confline_to_alias(line)
     -- alias directive without score
-    local key, val = string.match(line, '^alias%s+([%w%p]+)%s*=%s*(.+)')
+    local key, val = line:match('^alias%s+([%w%p]+)%s*=%s*(.+)')
     if key and val then
         add_alias(key, val)
         return true
     end
     -- alias directive with score
-    local score, key, val = string.match(line,
-        '^alias%(([%d+-.]+)%)%s+([%w%p]+)%s*=%s*(.+)')
+    local score, key, val = line:match('^alias%(([%d+-.]+)%)%s+([%w%p]+)%s*=%s*(.+)')
     if score then score = tonumber(score) end
     if key and val and score then
         add_alias(key, val, score)
@@ -106,7 +105,7 @@
         return true
     end
     -- stopalias directive
-    local key = string.match(line, '^stopalias%s+(.+)')
+    local key = line:match('^stopalias%s+(.+)')
     if key then
         stop_alias(key)
         return true

Modified: trunk/Master/texmf-dist/scripts/texdoc/texdoclib-cli.tlu
===================================================================
--- trunk/Master/texmf-dist/scripts/texdoc/texdoclib-cli.tlu	2025-02-11 17:36:05 UTC (rev 73875)
+++ trunk/Master/texmf-dist/scripts/texdoc/texdoclib-cli.tlu	2025-02-11 20:48:39 UTC (rev 73876)
@@ -58,14 +58,10 @@
                     end
 
                     -- check the existence of an argument
-                    if not tmp then
+                    if not tmp or tmp:match('^%-') then
                         err_print('error',
                             'Option -%s requires an argument.', jopt)
                         os.exit(C.exit_error)
-                    end
-
-                    if tmp:match('^%-') then
-                        table.insert(tab, {jopt, false})
                     else
                         table.insert(tab, {jopt, tmp})
                     end
@@ -121,7 +117,7 @@
             else
                 return true, option['long'], cl_config
             end
-        elseif option~=nil and option['group'] then
+        elseif option ~= nil and option['group'] then
             if option['type'] == 'boolean' then
                 option['action'](cl_config, curr_arg)
             elseif option['type'] == 'string' then
@@ -172,7 +168,7 @@
             texdoc.util.print_zsh_completion()
             os.exit(C.exit_ok)
         else
-            err_print('error', arg[1] .. ' is not supported currently!')
+            err_print('error', arg[1] .. ' is currently not supported.')
             os.exit(C.exit_error)
         end
     end

Modified: trunk/Master/texmf-dist/scripts/texdoc/texdoclib-config.tlu
===================================================================
--- trunk/Master/texmf-dist/scripts/texdoc/texdoclib-config.tlu	2025-02-11 17:36:05 UTC (rev 73875)
+++ trunk/Master/texmf-dist/scripts/texdoc/texdoclib-config.tlu	2025-02-11 20:48:39 UTC (rev 73876)
@@ -152,7 +152,8 @@
 
     -- special case: if we just set debug_list, print version info now
     if key == 'debug_list' then
-        dbg_print('version', '%s v%s', C.fullname, C.version)
+        local w32_path = import_function('util', 'w32_path')
+        dbg_print('version', '%s v%s', w32_path(C.fullname), C.version)
     end
 
     -- now tell what we have just done, for debugging

Modified: trunk/Master/texmf-dist/scripts/texdoc/texdoclib-const.tlu
===================================================================
--- trunk/Master/texmf-dist/scripts/texdoc/texdoclib-const.tlu	2025-02-11 17:36:05 UTC (rev 73875)
+++ trunk/Master/texmf-dist/scripts/texdoc/texdoclib-const.tlu	2025-02-11 20:48:39 UTC (rev 73876)
@@ -22,8 +22,8 @@
 -- progname and version
 fullname = kpse.find_file('texdoc/texdoclib', 'lua')
 progname = 'Texdoc'
-version = '4.1'
-release_date = '2024-03-10'
+version = '4.1.1'
+release_date = '2025-02-11'
 
 -- make sure to update setup_config_from_cl() accordingly
 -- and set a default value in setup_config_from_defaults() if relevant
@@ -63,16 +63,28 @@
     + debug
     {{debug}}
   )
-  _arguments -C -A $options \
-    '*: :->arguments' && return
-  case $state in
-    arguments)
-      local tlpdb="$(kpsewhich -var-value TEXMFROOT)/tlpkg/texlive.tlpdb"
-      _values package $(awk '/^name[^.]*$/ {print $2}' $tlpdb)
-    ;;
-  esac
+  _arguments -C -A $options '*:document:__texdoc_argument'
 }
 
+__texdoc_argument() {
+  _alternative \
+    "files:local documents:$(__texdoc_massage __texdoc_localfiles)" \
+    "aliases:aliases:$(__texdoc_massage __texdoc_aliases)" \
+    "packages:packages:$(__texdoc_massage __texdoc_packages)" \
+    "pdf:documents:$(__texdoc_massage __texdoc_lsr pdf)" \
+}
+
+# stdout of $@ is split at linebreaks, ordered, element-wise quoted, space joined, and ripped of empty words
+__texdoc_massage() { echo \(${(j: :)${(@q)${(ou)${(f)"$($@ 2>/dev/null)"}}}:#"''"}\) }
+
+__texdoc_localfiles() { find -L "$(kpsewhich -var-value TEXMFHOME)/doc" -type f -printf '%f\n' }
+__texdoc_aliases() { sed -n 's/^alias[^ ]* \(.*\) = .*$/\1/p' "${(f@)"$(texdoc --files|sed -n 's/^\s\+active\s\+//p')"}" }
+__texdoc_lsr() { grep -h "\\.$1$" "${(f@)"$(kpsewhich -all ls-R)"}" }
+__texdoc_packages() { # Use texlive.tlpdb if it exists, otherwise fallback to texdoc's own data
+  sed -n '/\./!s/^name //p' "${(f@)"$(kpsewhich -all -cnf-line='TEXINPUTS={$TEXMFROOT,$TEXMFHOME}/tlpkg' -format=tex texlive.tlpdb)"}" \
+  || sed -n 's/^  \["\([^"]*\)"\] = {$/\1/p' "$(kpsewhich Data.tlpdb.lua)"
+}
+
 if [[ $zsh_eval_context[-1] == loadautofunc ]]; then
   # autoload from fpath, call function directly
   __texdoc "$@"
@@ -268,7 +280,7 @@
 }
 
 copyright_msg = [[
-Copyright 2008-2024 Manuel Pégourié-Gonnard, Takuto Asakura, the TeX Live Team.
+Copyright 2008-2025 Manuel Pégourié-Gonnard, Takuto Asakura, the TeX Live Team.
 License GPLv3+: GNU GPL version 3 or later <https://gnu.org/licenses/gpl.html>.
 This is free software: you are free to change and redistribute it.]]
 
@@ -355,10 +367,13 @@
 max_verbosity = '3'
 def_verbosity = '2'
 
+-- debug categories
+-- the listed categories in the values are automatically activated
 known_debugs = {
     config = {'files'},
     files = {},
     search = {},
+    docfile = {'search'},
     score = {},
     texdocs = {},
     tlpdb = {},

Modified: trunk/Master/texmf-dist/scripts/texdoc/texdoclib-score.tlu
===================================================================
--- trunk/Master/texmf-dist/scripts/texdoc/texdoclib-score.tlu	2025-02-11 17:36:05 UTC (rev 73875)
+++ trunk/Master/texmf-dist/scripts/texdoc/texdoclib-score.tlu	2025-02-11 20:48:39 UTC (rev 73876)
@@ -150,17 +150,17 @@
 -- set the score of a docfile
 local function set_score(df, original_kw)
     -- scoring is case-insensitive (patterns are already lowercased)
-    local name = string.lower(df.normname)
-    local df_id = string.sub(md5.sumhexa(name), 1, 7)
+    local name = df.normname:lower()
+    local df_hash = md5.sumhexa(name):sub(1, 7)  -- we use normname hash for cross-platform consistency
 
     -- special debugging function
     local function dbg_score(msg, ...)
         -- add the hash id prefix to make the outputs grep-friendly
-        local msg = string.format('(%s) ', df_id) .. msg
+        local msg = string.format('(%s) ', df_hash) .. msg
         texdoc.util.dbg_print('score', msg, ...)
     end
 
-    dbg_score('Start scoring ' .. df.realpath)
+    dbg_score('Start scoring ' .. texdoc.util.w32_path(df.realpath))
     dbg_score('Name used: ' .. name)
 
     -- get score from patterns

Modified: trunk/Master/texmf-dist/scripts/texdoc/texdoclib-search.tlu
===================================================================
--- trunk/Master/texmf-dist/scripts/texdoc/texdoclib-search.tlu	2025-02-11 17:36:05 UTC (rev 73875)
+++ trunk/Master/texmf-dist/scripts/texdoc/texdoclib-search.tlu	2025-02-11 20:48:39 UTC (rev 73876)
@@ -7,6 +7,7 @@
 -- dependencies
 local kpse = require 'kpse'
 local lfs = require 'lfs'
+local md5 = require 'md5'
 local texdoc = {
     const = require 'texdoclib-const',
     util = require 'texdoclib-util',
@@ -75,15 +76,72 @@
     return dl
 end
 
+-- show debug information of docfile
+local function dbg_print_docfile(df, df_hash)
+    local function make_comma_list(res, cur)
+        if res == nil then
+            return cur
+        else
+            return res .. ', ' .. cur
+        end
+    end
+
+    local function dbg_df_item(item)
+        if not df[item] then return end
+
+        local value
+        if item == 'matches' then
+            if #df[item] == 0 then return end
+
+            local cur_pattern
+            for _, v in ipairs(df[item]) do
+                -- judge alias or not
+                if v.original then
+                    cur_pattern = v.name
+                else
+                    cur_pattern = v.name .. ' (alias)'
+                end
+
+                value = make_comma_list(value, cur_pattern)
+            end
+        elseif item == 'sources' then
+            for _, v in ipairs(df[item]) do
+                value = make_comma_list(value, v)
+            end
+        else
+            value = df[item]
+        end
+
+        local msg = string.format('(%s) %s: %s', df_hash, item, value)
+        dbg_print('docfile', msg)
+    end
+
+    -- mandatory info
+    dbg_df_item('name')
+    dbg_df_item('tree')
+    dbg_df_item('sources')
+
+    -- support info
+    dbg_df_item('matches')
+    dbg_df_item('runtodoc')
+    dbg_df_item('tlptodoc')
+
+    -- other details
+    dbg_df_item('details')
+    dbg_df_item('lang')
+end
+
 -- add a docfile to a list
 function Doclist:add(df)
     -- if no realpath information, unable to add
     -- (useful if vanilla == false)
     if not df.realpath then return end
+    local w32_path = texdoc.util.w32_path
+    local df_hash = md5.sumhexa(df.normname:lower()):sub(1, 7)  -- same as debug-score
 
     -- check the existence of the file
     if not lfs.isfile(df.realpath) then
-        dbg_print('search', 'File %s not found.  Skipping.', df.realpath)
+        dbg_print('search', '(%d) File %s not found.  Skipping.', df_hash, w32_path(df.realpath))
         return
     end
 
@@ -91,8 +149,11 @@
     local index = self.inv[df.realpath:lower()]
     if index then
         self[index]:mergein(df)
+        dbg_print('search', '(%s) Update info for %s.', df_hash, w32_path(df.realpath))
+        dbg_print_docfile(self[index], df_hash)
     else
-        dbg_print('search', 'File %s found.', df.realpath)
+        dbg_print('search', '(%s) File %s found.', df_hash, w32_path(df.realpath))
+        dbg_print_docfile(df, df_hash)
 
         local newindex = #self + 1
         self[newindex] = df
@@ -107,13 +168,17 @@
 
 --[[
 docfile = {
-    -- name and tree are mandatory
+    -- mandatory fields (never be nil)
     name      = filename (used for scoring only)
     tree      = code of the tree, see below
+    matches   = matched patterns: {pattern1, pattern2, ...} or {} (for sty and texdocs)
+    sources   = sources of the found docfile: {source1, source2, ...} or {}
+                (where <sourceN> is either 'sty', 'tlpdb', or 'texdocs')
+
     -- at least one of the following fields should exist
-    matches   = {pattern1, pattern2, ...} or {}
-    runtodoc  = true if there is a runfile -> docfile association
-    tlptodoc  = true if there is a tlp name -> docfile association
+    runtodoc  = true if there is a runfile -> docfile association (for tlpdb)
+    tlptodoc  = true if there is a tlp name -> docfile association (for tlpdb)
+
     -- those are virtual members, see below
     realpath  = full path
     normname  = nomrmalised (path removed up to the 'doc' component)
@@ -122,12 +187,14 @@
     details   = details tag from the catalogue metadata
     quality   = 'good', 'bad', or 'killed' depending on score
     ext_pos   = position of the extension in ext_list
+
     -- set for elements of a list as a side effect of sort_doclist()
     score     = score
 }
-if tree > 1, this is the index of the tree in TEXDOCS
+
+if tree > 0, this is the index of the tree in TEXDOCS
 if tree = 0, then name is relative to TLROOT
-tree = - 1 if and only if file is a sty file. Here name is absolute.
+tree = -1 if and only if file is a sty file. Here name is absolute.
 --]]
 
 -- Docfile objects inherit members from Docfile
@@ -160,11 +227,26 @@
 
 -- merge a second docfile object in, assuming it represents the same file
 function Docfile:mergein(df)
+    local function in_value(tab, val)
+        for _, v in pairs(tab) do
+            if v == val then
+                return true
+            end
+        end
+        return false
+    end
+
     for k, v in pairs(df) do
         if k == 'matches' then
-            for _, m in ipairs(df.matches or {}) do
-                table.insert(self.matches, m)
+            for _, m in ipairs(df[k] or {}) do
+                table.insert(self[k], m)
             end
+        elseif k == 'sources' then
+            for _, s in ipairs(df[k] or {}) do
+                if not in_value(self[k], s) then
+                    table.insert(self[k], s)
+                end
+            end
         else
             self[k] = v
         end
@@ -214,11 +296,15 @@
     return self.name:gsub('.*/', '')
 end
 
--- for interface consistency, matches should always be a table, never nil
+-- for interface consistency, matches and sources should always be a table, never nil
 function Docfile:get_matches()
     return {}
 end
 
+function Docfile:get_sources()
+    return {}
+end
+
 -- from texdoclib-score.tlu
 Docfile.get_quality = texdoc.score.docfile_quality
 
@@ -233,7 +319,7 @@
 local function matches(pattern, file)
     if pattern.original then
         return file:lower():find(pattern.name:lower(), 1, true)
-    else
+    else  -- alias
         return texdoc.score.is_exact(file, pattern.name)
     end
 end
@@ -249,11 +335,7 @@
                 tree = code,
                 pattern = pattern,
             }
-            if docfile then
-                docfile:mergein(Docfile:new(info))
-            else
-                docfile = Docfile:new(info)
-            end
+            docfile = Docfile:new(info)
         end
     end
     return docfile
@@ -263,7 +345,10 @@
 local function scan_db(patlist, code, lsr_db)
     for file, basename in pairs(lsr_db) do
         local df = process_file(patlist, basename, file, code)
-        if df then s_doclist:add(df) end
+        if df then
+            table.insert(df.sources, 'texdocs')
+            s_doclist:add(df)
+        end
     end
 end
 
@@ -359,6 +444,7 @@
 
     doc_roots = {}
     local kpse_texdocs = kpse.expand_var('$TEXDOCS')
+    local w32_path = texdoc.util.w32_path
 
     -- expand the path and turn it into a lua list
     local raw_doc_roots = kpse.expand_braces(kpse_texdocs):explode(C.kpse_sep)
@@ -376,13 +462,13 @@
         local index_mandatory = (n == 1)
         dbg_print('texdocs',
             'texdocs[%d] = %s (index_mandatory=%s, recursion_allowed=%s)',
-            i, path, tostring(index_mandatory), tostring(recursion_allowed))
+            i, w32_path(path), tostring(index_mandatory), tostring(recursion_allowed))
 
         -- decide if we should use a ls-R index, the filesystem, or do nothing
         local root, shift = lsr_root(path)
         if root and shift and recursion_allowed then
             dbg_print('texdocs',
-                'texdocs[%d] using index: %s (shift=%s)', i, root, shift)
+                'texdocs[%d] using index: %s (shift=%s)', i, w32_path(root), w32_path(shift))
             db = init_lsr_db(root, shift)
         elseif not index_mandatory and lfs.isdir(path) then
             dbg_print('texdocs',
@@ -419,6 +505,7 @@
             local df = Docfile:new({
                 name = file,
                 tree = -1,
+                sources = {'sty'},
                 pattern = pat,
             })
             s_doclist:add(df)
@@ -624,6 +711,7 @@
                 s_doclist:add(Docfile:new{
                     name = file,
                     tree = 0,
+                    sources = {'tlpdb'},
                     runtodoc = true,
                 })
             end
@@ -635,6 +723,7 @@
             s_doclist:add(Docfile:new{
                 name = file,
                 tree = 0,
+                sources = {'tlpdb'},
                 tlptodoc = true,
             })
         end
@@ -760,7 +849,6 @@
 
         -- get results; _texdocs search comes after _tlpdb search so that
         -- files found by both will have the priority of the _texdocs tree.
-        -- (https://puszcza.gnu.org.ua/bugs/?369)
         get_doclist_sty(sty)
         get_doclist_tlpdb(pattern)
         get_doclist_texdocs(normal)

Modified: trunk/Master/texmf-dist/scripts/texdoc/texdoclib-util.tlu
===================================================================
--- trunk/Master/texmf-dist/scripts/texdoc/texdoclib-util.tlu	2025-02-11 17:36:05 UTC (rev 73875)
+++ trunk/Master/texmf-dist/scripts/texdoc/texdoclib-util.tlu	2025-02-11 20:48:39 UTC (rev 73876)
@@ -241,6 +241,7 @@
             elseif type(opt['complete']) == 'table' then
                 choices = opt['complete']
             end
+            table.sort(choices)
             complete = '(' .. table.concat(choices, ' ') .. ')'
             if opt['complete'] == 'files' then
                 opt['metavar'] = ' '

Modified: trunk/Master/texmf-dist/scripts/texdoc/texdoclib.tlu
===================================================================
--- trunk/Master/texmf-dist/scripts/texdoc/texdoclib.tlu	2025-02-11 17:36:05 UTC (rev 73875)
+++ trunk/Master/texmf-dist/scripts/texdoc/texdoclib.tlu	2025-02-11 20:48:39 UTC (rev 73876)
@@ -1,7 +1,7 @@
 -- texdoclib.tlu: the texdoc library
 
 --[[
-Copyright 2008-2024 Manuel Pégourié-Gonnard, Takuto Asakura, the TeX Live Team.
+Copyright 2008-2025 Manuel Pégourié-Gonnard, Takuto Asakura, the TeX Live Team.
 
 This program is free software: you can redistribute it and/or modify it under
 the terms of the GNU General Public License as published by the Free Software

Modified: trunk/Master/texmf-dist/texdoc/texdoc.cnf
===================================================================
--- trunk/Master/texmf-dist/texdoc/texdoc.cnf	2025-02-11 17:36:05 UTC (rev 73875)
+++ trunk/Master/texmf-dist/texdoc/texdoc.cnf	2025-02-11 20:48:39 UTC (rev 73876)
@@ -465,11 +465,19 @@
 alias hyperref-dev = hyperref.pdf
 alias iso = isoman
 alias knuth-pdf = knuth-pdf/index.pdf
+alias kpsewhich = kpathsea
 alias kvoptions-patch = kvoptions  # XXX?
 alias layouts = layman
 alias lettrine = lettrine          # to hide context/third/lettrine-doc.pdf
 alias llmk = light-latex-make/llmk
 alias(2) llmk = light-latex-make/README
+alias mathfont = mathfont_user_guide
+alias mktexfmt = kpathsea
+alias mktexlsr = kpathsea
+alias mktexmf = kpathsea
+alias mktexpk = kpathsea
+alias mktextex = kpathsea
+alias mktextfm = kpathsea
 alias mls = montex
 alias musixtex = musixdoc
 alias newtxtext = newtxdoc



More information about the tex-live-commits mailing list.