* [PATCH] avoid localized output from external commands in a few completion @ 2017-12-25 23:40 Jun T. 2017-12-26 1:04 ` Bart Schaefer 0 siblings, 1 reply; 10+ messages in thread From: Jun T. @ 2017-12-25 23:40 UTC (permalink / raw) To: zsh-workers In some recent Linux distributions, output from commands like 'nm --help' is localized and can't be analyzed correctly by completion scripts. We need to reset LC_MESSAGES. diff --git a/Completion/Linux/Command/_lsblk b/Completion/Linux/Command/_lsblk index f37305445..f6bf9250d 100644 --- a/Completion/Linux/Command/_lsblk +++ b/Completion/Linux/Command/_lsblk @@ -44,7 +44,7 @@ case $state in ;| column*) values=( - ${${${${(f)"$(_call_program columns lsblk -h)"}[(r)Available*,-3]## #}[2,-1]//:/\\:}/ /:} + ${${${${(f)"$(_call_program columns LC_MESSAGES=C lsblk -h)"}[(r)Available*,-3]## #}[2,-1]//:/\\:}/ /:} ) _describe -t fields column values -M 'm:{a-z}={A-Z}' $suf -F dedup && ret=0 ;; diff --git a/Completion/Unix/Command/_nm b/Completion/Unix/Command/_nm index 146a69e8a..b195a66ef 100644 --- a/Completion/Unix/Command/_nm +++ b/Completion/Unix/Command/_nm @@ -64,7 +64,7 @@ if _pick_variant -r variant binutils=GNU elftoolchain=elftoolchain elfutils=elfu '--plugin[load specified plugin]:plugin' '--special-syms[include special symbols in the output]' '--synthetic[display synthetic symbols as well]' - "--target=[target object format]:targets:(${${(@M)${(f)$(_call_program targets nm --help)}:#*supported targets:*}##*: })" + "--target=[target object format]:targets:(${${(@M)${(f)$(_call_program targets LC_MESSAGES=C nm --help)}:#*supported targets:*}##*: })" '--with-symbol-versions[display version strings after symbol names]' ) ;; diff --git a/Completion/Unix/Command/_objdump b/Completion/Unix/Command/_objdump index e012b4cbc..9744d3177 100644 --- a/Completion/Unix/Command/_objdump +++ b/Completion/Unix/Command/_objdump @@ -92,13 +92,13 @@ case "$state" in _values -s , "dwarf section" rawline decodedline info abbrev pubnames aranges macro frames frames-interp str loc Ranges pubtypes gdb_index trace_info trace_abbrev trace_aranges addr cu_index ;; bfdname) - _values "object format" "${(z)${(@M)${(f)$(_call_program targets objdump --help)}##* supported targets:*}##*: }" + _values "object format" "${(z)${(@M)${(f)$(_call_program targets LC_MESSAGES=C objdump --help)}##* supported targets:*}##*: }" ;; machine) - _values "machine architecture" "${(@)${(z)${(@M)${(f)$(_call_program targets objdump --help)}##* supported architectures:*}##*: }//:/\\:}" + _values "machine architecture" "${(@)${(z)${(@M)${(f)$(_call_program targets LC_MESSAGES=C objdump --help)}##* supported architectures:*}##*: }//:/\\:}" ;; disassembler_options) - _values -s , "disassembler options" "${(@)${(@)${(@M)${(f)${(ps.-M switch.)$(_call_program targets objdump --help)}[2]}:# [^ ]*}# }%% *}" + _values -s , "disassembler options" "${(@)${(@)${(@M)${(f)${(ps.-M switch.)$(_call_program targets LC_MESSAGES=C objdump --help)}[2]}:# [^ ]*}# }%% *}" ;; esac diff --git a/Completion/Unix/Command/_strip b/Completion/Unix/Command/_strip index 0703c50e4..552c2839c 100644 --- a/Completion/Unix/Command/_strip +++ b/Completion/Unix/Command/_strip @@ -54,7 +54,7 @@ case $state in local expl declare -a bfdnames - bfdnames=(${=${(M)${(f)"$(_call_program bfdnames strip --help)"}:#strip: supported targets: *}#strip: supported targets: }) + bfdnames=(${=${(M)${(f)"$(_call_program bfdnames LC_MESSAGES=C strip --help)"}:#strip: supported targets: *}#strip: supported targets: }) _describe -t bfdnames 'bfd name' bfdnames && ret=0 ;; esac ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH] avoid localized output from external commands in a few completion 2017-12-25 23:40 [PATCH] avoid localized output from external commands in a few completion Jun T. @ 2017-12-26 1:04 ` Bart Schaefer 2017-12-26 1:19 ` Daniel Shahaf 0 siblings, 1 reply; 10+ messages in thread From: Bart Schaefer @ 2017-12-26 1:04 UTC (permalink / raw) To: Jun T.; +Cc: zsh-workers On Mon, Dec 25, 2017 at 3:40 PM, Jun T. <takimoto-j@kba.biglobe.ne.jp> wrote: > In some recent Linux distributions, output from commands > like 'nm --help' is localized and can't be analyzed correctly > by completion scripts. We need to reset LC_MESSAGES. Perhaps this is something that would better be done by _main_complete? Aren't other commands likely to become localized in the future? ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH] avoid localized output from external commands in a few completion 2017-12-26 1:04 ` Bart Schaefer @ 2017-12-26 1:19 ` Daniel Shahaf 2017-12-26 4:47 ` Jun T 0 siblings, 1 reply; 10+ messages in thread From: Daniel Shahaf @ 2017-12-26 1:19 UTC (permalink / raw) To: zsh-workers Bart Schaefer wrote on Mon, 25 Dec 2017 17:04 -0800: > On Mon, Dec 25, 2017 at 3:40 PM, Jun T. <takimoto-j@kba.biglobe.ne.jp> wrote: > > In some recent Linux distributions, output from commands > > like 'nm --help' is localized and can't be analyzed correctly > > by completion scripts. We need to reset LC_MESSAGES. > That won't help if LC_ALL is set. Shouldn't we just set LC_ALL=C, or use _comp_locale? > Perhaps this is something that would better be done by _main_complete? > Aren't other commands likely to become localized in the future? (No opinion; I use English.) ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH] avoid localized output from external commands in a few completion 2017-12-26 1:19 ` Daniel Shahaf @ 2017-12-26 4:47 ` Jun T 2017-12-26 4:59 ` Jun T 2017-12-26 5:24 ` Daniel Shahaf 0 siblings, 2 replies; 10+ messages in thread From: Jun T @ 2017-12-26 4:47 UTC (permalink / raw) To: zsh-workers > 2017/12/26 10:19、Daniel Shahaf <d.s@daniel.shahaf.name>のメール: > > Bart Schaefer wrote on Mon, 25 Dec 2017 17:04 -0800: >> On Mon, Dec 25, 2017 at 3:40 PM, Jun T. <takimoto-j@kba.biglobe.ne.jp> wrote: >>> In some recent Linux distributions, output from commands >>> like 'nm --help' is localized and can't be analyzed correctly >>> by completion scripts. We need to reset LC_MESSAGES. >> > > That won't help if LC_ALL is set. Shouldn't we just set LC_ALL=C, or > use _comp_locale? Oops, sorry. We need to reset LC_ALL. I didn't know _comp_locale; is it documented somewhere? >> Perhaps this is something that would better be done by _main_complete? Might be, but I'm not sure. zsh% tar --<TAB> gives a list of long options with localized description, because the output of 'tar --help' is localized and _tar uses '_arguments --' for completing long options. Although the localized description may not be "perfect", some user would still want to see it. How about adding an option (say -l) to _call_program so that _comp_locale is called before the command? ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH] avoid localized output from external commands in a few completion 2017-12-26 4:47 ` Jun T @ 2017-12-26 4:59 ` Jun T 2017-12-26 10:52 ` Jun T 2017-12-26 5:24 ` Daniel Shahaf 1 sibling, 1 reply; 10+ messages in thread From: Jun T @ 2017-12-26 4:59 UTC (permalink / raw) To: zsh-workers > 2017/12/26 13:47、I wrote: > > How about adding an option (say -l) to _call_program so that _comp_locale > is called before the command? Or is it better to make this potion default? ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH] avoid localized output from external commands in a few completion 2017-12-26 4:59 ` Jun T @ 2017-12-26 10:52 ` Jun T 2017-12-27 11:51 ` Jun T 0 siblings, 1 reply; 10+ messages in thread From: Jun T @ 2017-12-26 10:52 UTC (permalink / raw) To: zsh-workers With the patch below, both _call_program and '_arguments --' will call _comp_locale before running the external command. This is disabled by passing an option '-l' to _call_program or '_arguments --'. If this is OK, then we can remove LC_ALL=C from _aptitude and _a2ps, and _comp_locale from _subversion. I will also prepare patches for compsys.yo. It seems '_arguments --' (or _gnu_generic) is used only in _tar. I think we can use '_arguments -- -l' here, because non-English help output is handled rather well by '_arguments --' (at least as well as the English help). diff --git a/Completion/Base/Utility/_arguments b/Completion/Base/Utility/_arguments index d2c0d33de..136dd5826 100644 --- a/Completion/Base/Utility/_arguments +++ b/Completion/Base/Utility/_arguments @@ -43,7 +43,7 @@ if (( long )); then name="${name//[^a-zA-Z0-9_]/_}" if (( ! ${(P)+name} )); then - local iopts sopts pattern tmpo dir cur cache + local iopts sopts lflag pattern tmpo dir cur cache typeset -Ua lopts cache=() @@ -55,7 +55,12 @@ if (( long )); then iopts=() sopts=() - while [[ "$1" = -[is]* ]]; do + while [[ "$1" = -[lis]* ]]; do + if [[ "$1" = -l ]]; then + lflag='-l' + shift + continue + fi if [[ "$1" = -??* ]]; then tmp="${1[3,-1]}" cur=1 @@ -88,7 +93,8 @@ if (( long )); then # option up to the end. tmp=() - _call_program options ${~words[1]} --help 2>&1 | while IFS= read -r opt; do + _call_program $lflag options ${~words[1]} --help 2>&1 | + while IFS= read -r opt; do if (( ${#tmp} )); then # Previous line had no comment. Is the current one suitable? # It's hard to be sure, but if it there was nothing on the diff --git a/Completion/Base/Utility/_call_program b/Completion/Base/Utility/_call_program index 9a44f2d8e..73f3ef6d2 100644 --- a/Completion/Base/Utility/_call_program +++ b/Completion/Base/Utility/_call_program @@ -1,6 +1,6 @@ #autoload +X -local curcontext="${curcontext}" tmp err_fd=-1 +local curcontext="${curcontext}" tmp err_fd=-1 clocale='_comp_locale;' local -a prefix if [[ "$1" = -p ]]; then @@ -10,6 +10,9 @@ if [[ "$1" = -p ]]; then zstyle -t ":completion:${curcontext}:${1}" gain-privileges && prefix=( $_comp_priv_prefix ) fi +elif [[ "$1" = -l ]]; then + shift + clocale='' fi if (( ${debug_fd:--1} > 2 )) || [[ ! -t 2 ]] @@ -21,12 +24,12 @@ fi if zstyle -s ":completion:${curcontext}:${1}" command tmp; then if [[ "$tmp" = -* ]]; then - eval "$tmp[2,-1]" "$argv[2,-1]" + eval $clocale "$tmp[2,-1]" "$argv[2,-1]" else - eval $prefix "$tmp" + eval $clocale $prefix "$tmp" fi else - eval $prefix "$argv[2,-1]" + eval $clocale $prefix "$argv[2,-1]" fi 2>&$err_fd } always { ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH] avoid localized output from external commands in a few completion 2017-12-26 10:52 ` Jun T @ 2017-12-27 11:51 ` Jun T 2017-12-27 23:15 ` Daniel Shahaf 0 siblings, 1 reply; 10+ messages in thread From: Jun T @ 2017-12-27 11:51 UTC (permalink / raw) To: zsh-workers > 2017/12/26 19:52, Jun T <takimoto-j@kba.biglobe.ne.jp> wrote: > > If this is OK, then we can remove LC_ALL=C from _aptitude and _a2ps, > and _comp_locale from _subversion. I will also prepare patches for > compsys.yo. Here are patches for compsys.yo, _aptitude, _a2ps, _subversion and _tar. diff --git a/Completion/Debian/Command/_aptitude b/Completion/Debian/Command/_aptitude index b2b54599f..f79a100a8 100644 --- a/Completion/Debian/Command/_aptitude +++ b/Completion/Debian/Command/_aptitude @@ -80,7 +80,7 @@ _arguments -C \ case $state in cmds) - cmds=( ${${(M)${(f)"$(LC_ALL=C _call_program commands aptitude -h 2>/dev/null)"}:# [^- ][^ ]## *}/(#b) ([^ ]##) ##(- )#([^- ]*)/$match[1]:$match[3]:l}) + cmds=( ${${(M)${(f)"$(_call_program commands aptitude -h 2>/dev/null)"}:# [^- ][^ ]## *}/(#b) ([^ ]##) ##(- )#([^- ]*)/$match[1]:$match[3]:l}) _describe -t commands 'aptitude command' cmds && ret=0 ;; diff --git a/Completion/Unix/Command/_a2ps b/Completion/Unix/Command/_a2ps index c700c205d..aa2f4c3ba 100644 --- a/Completion/Unix/Command/_a2ps +++ b/Completion/Unix/Command/_a2ps @@ -7,7 +7,7 @@ if [[ "$words[1]" != "$_cache_a2ps_cmd" ]]; then _cache_a2ps_cmd="$words[1]" - descr=( "${(@)${(f@)$(_call_program features LC_ALL=C $words[1] --list=features)// + descr=( "${(@)${(f@)$(_call_program features $words[1] --list=features)// / }:#}" ) _cache_a2ps_values=( diff --git a/Completion/Unix/Command/_subversion b/Completion/Unix/Command/_subversion index b4ccccfae..6a35e9947 100644 --- a/Completion/Unix/Command/_subversion +++ b/Completion/Unix/Command/_subversion @@ -34,7 +34,7 @@ _svn () { typeset -gHA _svn_cmds if _cache_invalid svn-cmds || ! _retrieve_cache svn-cmds; then _svn_cmds=( - ${=${(f)${${"$(_comp_locale; _call_program commands svn help)"#l#*Available subcommands:}%%Subversion is a tool*}}/(#s)[[:space:]]#(#b)([a-z]##)[[:space:]]#(\([a-z, ?]##\))#/$match[1] :$match[1]${match[2]:+:${${match[2]//[(),]}// /:}}:} + ${=${(f)${${"$(_call_program commands svn help)"#l#*Available subcommands:}%%Subversion is a tool*}}/(#s)[[:space:]]#(#b)([a-z]##)[[:space:]]#(\([a-z, ?]##\))#/$match[1] :$match[1]${match[2]:+:${${match[2]//[(),]}// /:}}:} ) if (( $? == 0 )); then _store_cache svn-cmds _svn_cmds @@ -60,14 +60,14 @@ _svn () { if _cache_invalid svn-${cmd}-usage || \ ! _retrieve_cache svn-${cmd}-usage; then - usage=${${(M)${(f)"$(_comp_locale; _call_program options svn help $cmd)"}:#usage:*}#usage:*$cmd] } + usage=${${(M)${(f)"$(_call_program options svn help $cmd)"}:#usage:*}#usage:*$cmd] } _store_cache svn-${cmd}-usage usage fi if _cache_invalid svn-${cmd}-usage || \ ! _retrieve_cache svn-${cmd}-args; then args=( - ${=${${${(M)${(f)"$(_comp_locale; _call_program options svn help $cmd)"#(*Valid options:|(#e))}:#* :*}%% #:*}/ (arg|ARG)/:arg:}/(#b)(-##)([[:alpha:]]##) \[--([a-z-]##)\](:arg:)#/(--$match[3])$match[1]$match[2]$match[4] ($match[1]$match[2])--$match[3]$match[4]} + ${=${${${(M)${(f)"$(_call_program options svn help $cmd)"#(*Valid options:|(#e))}:#* :*}%% #:*}/ (arg|ARG)/:arg:}/(#b)(-##)([[:alpha:]]##) \[--([a-z-]##)\](:arg:)#/(--$match[3])$match[1]$match[2]$match[4] ($match[1]$match[2])--$match[3]$match[4]} ) while (( idx=$args[(I)*--accept:arg:] )); do args[(I)*--accept:arg:]=( --accept'=:automatic conflict resolution action:((working\:working base\:base '"`for i j in p postpone mc mine-conflict tc theirs-conflict mf mine-full tf theirs-full e edit l launch; do print -rn $i\\\\:$j $j\\\\:$j ""; done `"'))' ) @@ -227,7 +227,7 @@ _svnadmin () { if [[ -n $state ]] && (( ! $+_svnadmin_cmds )); then typeset -gHA _svnadmin_cmds _svnadmin_cmds=( - ${=${(f)${${"$(_comp_locale; _call_program commands svnadmin help)"#l#*Available subcommands:}}}/(#s)[[:space:]]#(#b)([-a-z]##)[[:space:]]#(\([a-z, ?]##\))#/$match[1] :$match[1]${match[2]:+:${${match[2]//[(),]}// /:}}:} + ${=${(f)${${"$(_call_program commands svnadmin help)"#l#*Available subcommands:}}}/(#s)[[:space:]]#(#b)([-a-z]##)[[:space:]]#(\([a-z, ?]##\))#/$match[1] :$match[1]${match[2]:+:${${match[2]//[(),]}// /:}}:} ) fi @@ -242,9 +242,9 @@ _svnadmin () { if (( $#cmd )); then curcontext="${curcontext%:*:*}:svnadmin-${cmd}:" - usage=${${(M)${(f)"$(_comp_locale; _call_program options svnadmin help $cmd)"}:#$cmd: usage:*}#$cmd: usage: svnadmin $cmd } + usage=${${(M)${(f)"$(_call_program options svnadmin help $cmd)"}:#$cmd: usage:*}#$cmd: usage: svnadmin $cmd } args=( - ${=${${${(M)${(f)"$(_comp_locale; _call_program options svnadmin help $cmd)"#(*Valid options:|(#e))}:#* :*}%% #:*}/ (arg|ARG)/:arg:}/(#b)-([[:alpha:]]) \[--([a-z-]##)\](:arg:)#/(--$match[2])-$match[1]$match[3] (-$match[1])--$match[2]$match[3]} + ${=${${${(M)${(f)"$(_call_program options svnadmin help $cmd)"#(*Valid options:|(#e))}:#* :*}%% #:*}/ (arg|ARG)/:arg:}/(#b)-([[:alpha:]]) \[--([a-z-]##)\](:arg:)#/(--$match[2])-$match[1]$match[3] (-$match[1])--$match[2]$match[3]} ) # All options get {-x+,--long-x=} args=( ${args/(#b)(--[A-Za-z0-9-]##):arg:/$match[1]=:arg:} ) @@ -429,7 +429,7 @@ _svn_props() { _svn_changelists() { local cls - cls=( ${${${(M)${(f)"$(_comp_locale; _call_program changelists svn status 2>/dev/null)"}:#--- Changelist*}%??}##*\'} ) + cls=( ${${${(M)${(f)"$(_call_program changelists svn status 2>/dev/null)"}:#--- Changelist*}%??}##*\'} ) compadd "$@" -a cls && return 0 } diff --git a/Completion/Unix/Command/_tar b/Completion/Unix/Command/_tar index ecf02fd83..cff50562e 100644 --- a/Completion/Unix/Command/_tar +++ b/Completion/Unix/Command/_tar @@ -99,7 +99,7 @@ if [[ "$PREFIX" = --* ]]; then # ...long options after `--'. - _arguments -- '--owner=*:user:_users' \ + _arguments -- -l '--owner=*:user:_users' \ '--group=*:group:_groups' \ '--atime-preserve*::method:(replace system)' \ '--*-script=NAME:script file:_files' \ diff --git a/Doc/Zsh/compsys.yo b/Doc/Zsh/compsys.yo index 36afd7305..a0e99f2e4 100644 --- a/Doc/Zsh/compsys.yo +++ b/Doc/Zsh/compsys.yo @@ -3596,7 +3596,8 @@ findex(_arguments) redef(SPACES)(0)(tt(ifztexi(NOTRANS(@ @ @ @ @ @ @ @ @ @ @ ))ifnztexi( ))) xitem(tt(_arguments )[ tt(-nswWCRS) ] [ tt(-A) var(pat) ] [ tt(-O) var(name) ] [ tt(-M) var(matchspec) ]) xitem(SPACES()[ tt(:) ] var(spec) ...) -item(tt(_arguments) [ var(opt) ... ] tt(-)tt(-) [ tt(-i) var(pats) ] [ tt(-s) var(pair) ] [ var(helpspec) ... ])( +xitem(tt(_arguments )[ var(opt) ... ] tt(-)tt(-) [ tt(-l) ] [ tt(-i) var(pats) ] [ tt(-s) var(pair) ]) +item(SPACES()[ var(helpspec) ...])( This function can be used to give a complete specification for completion for a command whose arguments follow standard UNIX option and argument conventions. @@ -4139,6 +4140,12 @@ pattern and the var(action) will be used only directly after the `tt(=)', not in the next word. This is the behaviour of a normal specification defined with the form `tt(=-)'. +By default, the command (with the option `tt(--help)') is run after +resetting all the locale categories (except for tt(LC_CTYPE)) to `tt(C)'. +If the localized help output is known to work, the option `tt(-l)' can +be specified after the `tt(_arguments -)tt(-)' so that the command is +run in the current locale. + The `tt(_arguments -)tt(-)' can be followed by the option `tt(-i) var(patterns)' to give patterns for options which are not to be completed. The patterns can be given as the name of an array parameter @@ -4230,7 +4237,7 @@ The return status of tt(_call_function) itself is zero if the function var(name) exists and was called and non-zero otherwise. ) findex(_call_program) -item(tt(_call_program) [ tt(-p) ] var(tag) var(string) ...)( +item(tt(_call_program) [ tt(-l) ] [ tt(-p) ] var(tag) var(string) ...)( This function provides a mechanism for the user to override the use of an external command. It looks up the tt(command) style with the supplied var(tag). If the style is set, its value is used as the command to @@ -4239,6 +4246,11 @@ style if set, are concatenated with spaces between them and the resulting string is evaluated. The return status is the return status of the command called. +By default, the command is run in an environment where all the locale +categories (except for tt(LC_CTYPE)) are reset to `tt(C)' by calling the +utility function tt(_comp_locale) (see below). If the option `tt(-l)' is +given, the command is run with the current locale. + If the option `tt(-p)' is supplied it indicates that the command output is influenced by the permissions it is run with. If the tt(gain-privileges) style is set to true, tt(_call_program) will make @@ -4299,6 +4311,18 @@ This function completes words that are valid at command position: names of aliases, builtins, hashed commands, functions, and so on. With the tt(-e) flag, only hashed commands are completed. The tt(-) flag is ignored. ) +findex(_comp_locale) +item(tt(_comp_locale))( +This function resets all the locale categories other than tt(LC_CTYPE) to +`tt(C)' so that the output from external commands can be easily analyzed by +the completion system. tt(LC_CTYPE) retains the current value (either +explicitly set or inherited from tt(LC_ALL) or tt(LANG)), ensuring that +non-ASCII characters in file names are still handled properly. + +This function should normally be run only in a subshell, because the new +locale is exported to the environment. Typical usage would be +`tt($LPAR()_comp_locale; )var(command) ...tt(RPAR())'. +) findex(_completers) item(tt(_completers) [ tt(-p) ])( This function completes names of completers. ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH] avoid localized output from external commands in a few completion 2017-12-27 11:51 ` Jun T @ 2017-12-27 23:15 ` Daniel Shahaf 2017-12-28 2:54 ` Jun T 0 siblings, 1 reply; 10+ messages in thread From: Daniel Shahaf @ 2017-12-27 23:15 UTC (permalink / raw) To: Jun T; +Cc: zsh-workers Jun T wrote on Wed, Dec 27, 2017 at 20:51:30 +0900: > +++ b/Doc/Zsh/compsys.yo > @@ -4299,6 +4311,18 @@ This function completes words that are valid at command position: names of > +item(tt(_comp_locale))( > +This function resets all the locale categories other than tt(LC_CTYPE) to > +`tt(C)' so that the output from external commands can be easily analyzed by > +the completion system. tt(LC_CTYPE) retains the current value (either > +explicitly set or inherited from tt(LC_ALL) or tt(LANG)), ensuring that > +non-ASCII characters in file names are still handled properly. > + Thanks for adding this! One comment: the language "inherited" could be confusing in this usage. (Normally inheritance works from a parent class to a subclass, but here LC_ALL and LANG are a parent and a child of LC_CTYPE.) How about, for example: diff --git a/Doc/Zsh/compsys.yo b/Doc/Zsh/compsys.yo index a0e99f2e4..336a7ec37 100644 --- a/Doc/Zsh/compsys.yo +++ b/Doc/Zsh/compsys.yo @@ -4315,8 +4315,8 @@ findex(_comp_locale) item(tt(_comp_locale))( This function resets all the locale categories other than tt(LC_CTYPE) to `tt(C)' so that the output from external commands can be easily analyzed by -the completion system. tt(LC_CTYPE) retains the current value (either -explicitly set or inherited from tt(LC_ALL) or tt(LANG)), ensuring that +the completion system. tt(LC_CTYPE) retains the current value (taking +tt(LC_ALL) and tt(LANG) into account), ensuring that non-ASCII characters in file names are still handled properly. This function should normally be run only in a subshell, because the new Cheers, Daniel > +This function should normally be run only in a subshell, because the new > +locale is exported to the environment. Typical usage would be > +`tt($LPAR()_comp_locale; )var(command) ...tt(RPAR())'. > +) > findex(_completers) > item(tt(_completers) [ tt(-p) ])( > This function completes names of completers. > > > > > ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH] avoid localized output from external commands in a few completion 2017-12-27 23:15 ` Daniel Shahaf @ 2017-12-28 2:54 ` Jun T 0 siblings, 0 replies; 10+ messages in thread From: Jun T @ 2017-12-28 2:54 UTC (permalink / raw) To: zsh-workers > 2017/12/28 8:15、Daniel Shahaf <d.s@daniel.shahaf.name> wrote: > > One comment: the language "inherited" could be confusing in this usage. > (Normally inheritance works from a parent class to a subclass, but here LC_ALL > and LANG are a parent and a child of LC_CTYPE.) I think LANG is not a child of (derived from) LC_CTYPE, but anyway I don't care about the exact wording. I've pushed the patch with your suggestion. Thanks. ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH] avoid localized output from external commands in a few completion 2017-12-26 4:47 ` Jun T 2017-12-26 4:59 ` Jun T @ 2017-12-26 5:24 ` Daniel Shahaf 1 sibling, 0 replies; 10+ messages in thread From: Daniel Shahaf @ 2017-12-26 5:24 UTC (permalink / raw) To: zsh-workers Jun T wrote on Tue, 26 Dec 2017 13:47 +0900: > I didn't know _comp_locale; is it documented somewhere? Doesn't seem so. Let's add it to the manual. ^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2017-12-28 2:54 UTC | newest] Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2017-12-25 23:40 [PATCH] avoid localized output from external commands in a few completion Jun T. 2017-12-26 1:04 ` Bart Schaefer 2017-12-26 1:19 ` Daniel Shahaf 2017-12-26 4:47 ` Jun T 2017-12-26 4:59 ` Jun T 2017-12-26 10:52 ` Jun T 2017-12-27 11:51 ` Jun T 2017-12-27 23:15 ` Daniel Shahaf 2017-12-28 2:54 ` Jun T 2017-12-26 5:24 ` Daniel Shahaf
Code repositories for project(s) associated with this public inbox https://git.vuxu.org/mirror/zsh/ This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).