On Sun, Feb 23, 2025 at 03:51:47PM +0000, Gavin Smith wrote: > I've commited code to use a hook program under > "XDG_CONFIG_DIRS/texinfo/info-hooks/manual-not-found", where XDG_CONFIG_DIRS > could be e.g. $HOME/.config or /etc/xdg.
Previous discussion: https://lists.gnu.org/archive/html/bug-texinfo/2025-02/msg00153.html Older: https://lists.gnu.org/archive/html/help-texinfo/2024-01/msg00041.html I've finally gotten around to writing documentation for this new feature. See below. This feature still needs work: * At what point do we run the hook - before checking for man pages, or after? E.g. if "tar.info" is not installed but the tar man page is installed, should "info tar" run the hook, or display the man page (or somehow run the hook and then display the man page afterwards)? More than one hook, or options passed to hooks, might be necessary to accommodate all the possibilities. * Do we want to provide a default implementation of the hook referring users to download manuals from <https://www.gnu.org/manual/manual.html>? 16 Hooks for when a Manual is not Found *************************************** Sometimes an Info manual might exist, but not be installed on a user's system. By default, if Info cannot find a manual given on the command line, Info prints an error message. The user would not be told about the existence of the Info manual, and they might assume that one does not exist, leading them to resort to worse sources of information such as man pages or even random Internet forums. Info provides “hooks” that can improve this situation. A hook might check for information on the availability of a manual and give the user advice on how to install it, such as how to download it from the Internet or via their operating system package manager. This hook is intended to offer similar functionality to the ‘command_not_found_handle’ function of the Bash shell (*note (bash)Command Search and Execution::), which is used to advise on uninstalled programs. To define a hook, you place an executable program by the same name in the directory ‘$XDG_CONFIG_DIRS/texinfo/info-hooks’, where ‘$XDG_CONFIG_DIRS’ is one of the XDG directories described in the previous chapter (*note Custom Key Bindings::). Currently, Info has the following hook: ‘manual-not-found’ This hook runs if a manual is not found. The program is passed one argument on the command line, which is the name of the manual. For example, if the hook is implemented as a shell script, it could look like this: #!/bin/sh echo "Manual '$1' not found" exit 0 If the exit status of the hook is 0, then Info exits. Otherwise (perhaps if the hook program encountered some problem), Info keeps on running as before, probably exiting with its usual error message.