Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Bug#254801: zsh: iconv code set completion case insensitivity
- X-seq: zsh-workers 20069
- From: Oliver Kiddle <okiddle@xxxxxxxxxxx>
- To: zsh-workers@xxxxxxxxxx
- Subject: Re: Bug#254801: zsh: iconv code set completion case insensitivity
- Date: Thu, 17 Jun 2004 15:03:49 +0200
- Cc: Hugo Haas <hugo@xxxxxxxxx>, 254801-forwarded@xxxxxxxxxxxxxxx
- In-reply-to: <20040616235219.GA18736@xxxxxxxxxxx>
- Mailing-list: contact zsh-workers-help@xxxxxxxxxx; run by ezmlm
- References: <20040616184219.GA7569@xxxxxxxxx> <20040616235219.GA18736@xxxxxxxxxxx>
Clint wrote:
> >
> > However, iconv doesn't matter about the case of the character encoding
> > name given, which is legit AFAIK.
> >
> > Is it possible to make the completion case insensitive too?
>
> It's possible. Does it make sense to do it for all platforms, or is
> there an iconv out there that cares about case?
As far as I can tell, it is only GNU iconv which doesn't care about
case. Anyway, it's easy to fix. This patch also makes it use
_call_program and does the job of using LOCPATH on OSF properly.
Oliver
Index: _iconv
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/Unix/Command/_iconv,v
retrieving revision 1.3
diff -u -r1.3 _iconv
--- _iconv 12 Mar 2003 18:55:38 -0000 1.3
+++ _iconv 17 Jun 2004 12:30:19 -0000
@@ -1,6 +1,7 @@
#compdef iconv
-local expl curcontext="$curcontext" state line codeset LOCPATH ret=1
+local expl curcontext="$curcontext" state line codeset ret=1
+local LOCPATH="${LOCPATH:-/usr/lib/nls/loc}"
if _pick_variant gnu=GNU unix --version; then
@@ -22,8 +23,9 @@
if compset -P '*/'; then
_wanted option expl option compadd "$@" /TRANSLIT && ret=0
else
- _wanted codesets expl 'code set' compadd "$@" -M 'r:|-=* r:|=*' \
- ${${${(f)"$(iconv --list|sed -n '/^$/,$ p')"}## #}%//} && ret=0
+ _wanted codesets expl 'code set' compadd "$@" \
+ -M 'm:{a-zA-Z}={A-Za-z} r:|-=* r:|=*' \
+ ${${${(f)"$(_call_program codesets iconv --list|sed -n '/^$/,$ p')"}## #}%//} && ret=0
fi
fi
@@ -38,7 +40,7 @@
if [[ $state = codeset ]]; then
if [[ -f /usr/lib/iconv/iconv_data ]]; then # IRIX & Solaris
codeset=( ${${(f)"$(</usr/lib/iconv/iconv_data)"}%%[[:blank:]]*} )
- elif [[ -d ${LOCPATH:=/usr/lib/nls/loc}/iconv ]]; then # OSF
+ elif [[ -d $LOCPATH/iconv ]]; then # OSF
codeset=( $LOCPATH/iconv/*(N:t) )
codeset=( ${(j:_:s:_:)codeset} )
else
Messages sorted by:
Reverse Date,
Date,
Thread,
Author