sergio/takana
> Una distribución Linux construida con un laboratorio funcional y hermético en el > sótano, y una terminal mutable, clásica y anárquica en el piso de arriba — diseñada > desde el suelo para que una IA programadora entienda, modifique y co…
⎇ 32bc854be3b06a1932240d1746834b8cd98ca891
recipes/0001-50278-use-man-w-in-preference-to-manpath-fix-caching.patch
Ñawpa willay
ch'uya
zsh: el shell de login del usuario, que no tenía receta en ninguna de las cinco colas
1From 1e52cd968d7ffd9da3249ef01f6c41f8b29e4df3 Mon Sep 17 00:00:00 2001
2From: Bart Schaefer <schaefer@zsh.org>
3Date: Sun, 22 May 2022 15:50:45 -0700
4Subject: [PATCH] 50278: use `man -w` in preference to `manpath`; fix caching
5 and precedence of -M
6
7---
8 ChangeLog | 5 ++++
9 Completion/Unix/Command/_man | 45 ++++++++++++++++++++++--------------
10 2 files changed, 33 insertions(+), 17 deletions(-)
11
12diff --git a/Completion/Unix/Command/_man b/Completion/Unix/Command/_man
13index dba1d13dc..190811e41 100644
14--- a/Completion/Unix/Command/_man
15+++ b/Completion/Unix/Command/_man
16@@ -16,7 +16,7 @@
17 _man() {
18 local dirs expl mrd awk variant noinsert
19 local -a context line state state_descr args modes
20- local -aU sects
21+ local -aU sects _manpath
22 local -A opt_args val_args sect_descs
23
24 if [[ $service == man ]]; then
25@@ -168,29 +168,40 @@ _man() {
26 _arguments -s -S : $args '*::: :->man' && return 0
27 [[ -n $state ]] || return 1
28
29+ # Override man path
30+ [[ -n ${opt_args[-M]} ]] &&
31+ _manpath=( ${(s<:>)opt_args[-M]} )
32+
33+ # Restore cached man path to avoid $(manpath) if we can
34 if (( ! $#_manpath )); then
35- local mp
36- mp=( ${(s.:.)$(manpath 2>/dev/null)} )
37- [[ "$mp" == *:* ]] && mp=( ${(s.:.)mp} )
38- if (( $#mp )); then
39- _manpath=( $mp )
40- elif (( $#manpath )); then
41- _manpath=( $manpath )
42+ if (( ! $+_manpath_cache )); then
43+ typeset -gHA _manpath_cache
44 fi
45+ if [[ -z $_manpath_cache[$MANPATH] ]]; then
46+ local mp
47+ mp=( ${(s.:.)$({ command man -w || manpath } 2>/dev/null)} )
48+ [[ "$mp" == *:* ]] && mp=( ${(s.:.)mp} )
49+ if (( $#mp )); then
50+ _manpath_cache[$MANPATH]=${(j.:.)mp}
51+ elif (( $#manpath )); then
52+ _manpath_cache[$MANPATH]=$MANPATH
53+ fi
54+ fi
55+ _manpath=( ${(s.:.)_manpath_cache[$MANPATH]} )
56+ fi
57+
58+ # Augment man path
59+ if [[ -n ${opt_args[-m]} ]]; then
60+ [[ $variant == (netbsd|openbsd)* ]] &&
61+ _manpath+=( ${(s<:>)opt_args[-m]} )
62+ elif [[ $variant == aix* ]]; then
63+ # _manpath declared -U so no need to test
64+ _manpath+=( /usr/share/man )
65 fi
66
67 (( $#_manpath )) ||
68 _manpath=( /usr/man(-/) /(opt|usr)/(pkg|dt|share|X11R6|local)/(cat|)man(-/) )
69
70- # Override man path
71- [[ -n ${opt_args[-M]} ]] &&
72- _manpath=( ${(s<:>)opt_args[-M]} )
73-
74- # Augment man path
75- [[ $variant == (netbsd|openbsd)* ]] &&
76- [[ -n ${opt_args[-m]} ]] &&
77- _manpath+=( ${(s<:>)opt_args[-m]} )
78-
79 # `sman' is the SGML manual directory for Solaris 7.
80 # 1M is system administrator commands on SVR4
81
82--
832.48.1
84