4 July 2021 3:58 AM (emacs | msys2 | windows)
I've been annoyed at MSYS2 for a while because Info manuals included with Emacs wouldn't show up when I opened info
. The few manuals that were installed through ELPA packages showed up fine.
Some time ago I discovered this was because I installed the mingw-w64-x86_64-emacs
package from MSYS2, and this package installs all the info manuals into /mingw64/share/info
instead of /usr/share/info
and there was no dir
file in there. I couldn't quite remember how this worked so I left it alone. At least I understood what was going on.
Recently I finally took the time to look at it again. I remembered that pacman has some capabilities for hooks. I wrote a very simple one for myself to keep my Pacman mirror list updated automatically. But I couldn't remember where the default ones were located. pacman
to the rescue. pacman -Ql pacman | less
with a quick search for hooks
and I discovered that these hooks live in /usr/share/libalpm/hooks/
. A quick look in there showed that MSYS2 distributes a couple of hooks: texinfo-install.hook
and texinfo-remove.hook
. When a package gets installed, upgraded, or removed one of these hooks gets called.
Basically what the -install
hook does is go through each file in the installed packages that is under /usr/share/info
and call install-info
on it. That's great, easy to reproduce on the command line:
find /mingw64/share/info -fype f -name '*.info' -exec install-info '{}' /mingw64/share/info/dir \;
This sets it up the first time, since I already have Emacs installed and didn't want to reinstall it.
[Trigger] Type = Path Operation = Install Operation = Upgrade Target = mingw64/share/info/* [Action] Description = Updating the mingw64 info directory file... When = PostTransaction Exec = /usr/bin/sh -c 'while read -r f; do install-info "$f" /mingw64/share/info/dir 2> /dev/null; done' NeedsTargets
Put this in /etc/pacman.d/hooks/texinfo-install-mingw64.hook
(or C:/msys2/etc/pacman.d/hooks/texinfo-install-mingw64.hook
if you're working from Emacs), and now every time a package gets installed or upgraded and it has any files in /mingw64/share/info/
it should automatically update the dir
file and give you access to all those info manuals.
The remove hook is basically the same, except it passes in the --delete
option to install-info
to remove the entries from the dir
file.
[Trigger] Type = Path Operation = Remove Target = mingw64/share/info/* [Action] Description = Removing old entries from the mingw64 info directory file... When = PreTransaction Exec = /usr/bin/sh -c 'while read -r f; do install-info --delete "$f" /mingw64/share/info/dir 2> /dev/null; done' NeedsTargets