#!c:sksh

#*************************************************************************
# This function sets emacs mode editing
#*************************************************************************

   if [ "$1" = '-?' ]
   then
      echo 'Usage:' $(basename $0)
      echo '       (sets command line editing to emacs mode)'
      return 1
   fi

   [ "$SIZE" = 'normal' ] ||
       echo "This command does not operate with Tiny_SKsh." && return 2

   options -e                          # turn on command line editing

   setmap -r                           # reset the keymap

   setmap -m 0 BOL ISM '#' PIO ACC     # comment out line macro

   setmap 0  8 BS   9  CC1  1  BOL  2 LFT   4  DEL  127 DEL  5 EOL  6 RHT \
             7 ZAP  11 KEL  14 DN   15 EXE  16 UP   18  SRH 27 @1 155 @2 \
             12 RDL 26 TIM  21 REP 20 SPC 25 YNK

   setmap 1  27 CC1  = CC2  \* CC3  8 BDW  f FWW  b BKW  d DLW  \. ILP \
             \/ ILT  '<' HOL  '>' TOL  '#' '!0'  48 ERC  49 ERC  50 ERC \
             51 ERC  52 ERC  53 ERC  54 ERC  55 ERC  56 ERC  57 ERC

   setmap 2  A UP   B DN  C RHT  D LFT  T HOL  S TOL  ' ' @3 \
             48 FNK  49 FNK  50 FNK  51 FNK  52 FNK  53 FNK  54 FNK \
             55 FNK  56 FNK  57 FNK

   setmap 3  A BKW  @ FWW

   echo "\nCommand line editing set to emacs mode.\n"
