> Date: Wed, 10 May 2006 02:04:43 +0200
> From: Roland Mainz <roland.mainz at nrubsig.org>
> X-Accept-Language: en
> MIME-Version: 1.0
> To: ast-users <ast-users at research.att.com>, ksh93-integration-discuss
<ksh93-integration-discuss at opensolaris.org>
> CC: April Chin <April.Chin at eng.sun.com>
> Subject: TAB-TAB completion patch #003 (which makes "gmacs" the default
> editor
mode) / was: Re: [ast-users] RFE: Make TAB completion in ksh93 work like
ESC-'='...
> X-ID: bdlyZiZVgeQfjihegvdcB-pJpVfmTpdkH6+Yts17ykwPkDhPYb6toN at t-dialin.net
> X-TOI-MSGID: 051d1a0f-4cc6-46b2-9ecf-b91e8d0a7e4c
>
> Roland Mainz wrote:
> > Roland Mainz wrote:
> > > Attached is a small patch ("ksh93_tab_completion_choice.diff.txt" ;
> > > relative to the current Solaris OS/Net tree, but it should apply to
> > > ksh93r cleanly, too) which may be usefull for integration into ksh93r+.
> > >
> > > The patch changes the behaviour of the TAB completion in emacs mode to
> > > preview a list of choices (e.g. equilavent to ESC-'=') instead of doing
> > > the completion itself which may be much more usefull when many file name
> > > are matching the given pattern (it also contains a comment how to make
> > > it slightly "better", however I am not sure (yet) how this can be done
> > > easily).
> > >
> > > Little bit testing with our students showed that they like it more than
> > > the current TAB completion... :-)
> > >
> > > Basically the patch is equivalent to
> > > -- snip --
> > > function emacs_completion
> > > {
> > > if [[ ${.sh.edchar} == "$(printf "\t")" ]] then
> > > .sh.edchar="$(printf "\E=")"
> > > true
> > > fi
> > > }
> > >
> > > trap emacs_completion KEYBD
> > > -- snip --
> >
> > Actually it could be done better... attached is a 2nd patch
> > ("ksh93_tab_tab_gmacs_completion_try2.diff.txt") which also implements
> > TAB-TAB completion like in bash3.
> > Single TAB now completes the filename either completely - or if that
> > isn't possible it's completed to the point where the filenames start to
> > differ. TAB-TAB then displays a list of choices. Additionally in "gmacs"
> > mode typing TAB on an empty string will try to do the filename
> > completion for the whole directory (and TAB-TAB displays all choices
> > then). "emacs" mode still behaves as usual, incl. the ability to enter
> > the TAB character.
> > (note: the previous patch was tested for ~~one week, the current one is
> > more or less untested) ...
>
> Attached is now the 3rd version... the only difference to the previous
> patch is that I added a way to provide a default editor mode (set to
> "gmacs" for the initial ksh93-integration (and to aid the migration of
> bash2/3 users to ksh93)). Basically it is an equivalent to the following
> ksh93 shell code:
> -- snip --
> emacs_completion_tab_count=0
>
> function emacs_completion
> {
> if [[ ${.sh.edchar} == "$(printf "\t")" ]] then
> emacs_completion_tab_count=$((emacs_completion_tab_count + 1))
>
> if [ $emacs_completion_tab_count -eq 1 ] ; then
> .sh.edchar="$(printf "\E\E")"
> elif [ $emacs_completion_tab_count -ge 2 ] ; then
> .sh.edchar="$(printf "\E=")"
> fi
> else
> emacs_completion_tab_count=0
> fi
> }
>
> trap emacs_completion KEYBD
> set -o gmacs
> -- snip --
>
> David/April: Are there any objections of making the "gmacs" editor mode
> the "default" for both Solaris (for both "ksh93r+" and
> ksh93-integration) and Linux ?
Solaris ksh also does not have a default editor mode if
VISUAL and EDITOR are not set. A default seems like a good idea.
Is there any reason for gmacs over emacs or vi mode?
April
>
> ----
>
> Bye
> Roland
>
> --
> __ . . __
> (o.\ \/ /.o) roland.mainz at nrubsig.org
> \__\/\/__/ MPEG specialist, C&&JAVA&&Sun&&Unix programmer
> /O /==\ O\ TEL +49 641 7950090
> (;O/ \/ \O;)