home *** CD-ROM | disk | FTP | other *** search
/ InfoMagic Source Code 1993 July / THE_SOURCE_CODE_CD_ROM.iso / languages / elisp / modes / J-Shell-1.1 / dot-kshrc < prev    next >
Encoding:
Text File  |  1993-04-03  |  1.5 KB  |  61 lines

  1. # $Id: dot-kshrc,v 1.1 1993/04/03 22:14:37 jct Exp $
  2.  
  3. ## This file contains a sample script showing how to set up ksh to
  4. ## work properly with j-shell.  Before examining this script, please
  5. ## read the comments in the file dot-tcsh; the comments in that script
  6. ## describe steps common to the scripts for all shells.
  7.  
  8. # Comments delimited by a single # are specific to ksh.
  9.  
  10. if [ "$TERM" = "emacs" ]
  11. then
  12.     stty nl -echo        # Keeps ^M from echoing
  13.  
  14.     ## Step A.
  15.     emacscd="\033EmAcScd"
  16.     emacshost="\033EmAcShost"
  17.  
  18.     ## Step B.
  19.     # Note that we have to use a function instead of an alias in
  20.     # ksh; an alias doesn't seem to work.
  21.     cwdcmd() { echo $emacscd $PWD ; }
  22.     hostcmd() { echo $emacshost `hostname` ; }
  23.     reorient() { cwdcmd ; hostcmd ; }
  24.  
  25.     ## Step C.
  26.     # In ksh, it seems that an alias can't reference the command
  27.     # that it is replacing, as it can in csh.  Thus, we need two
  28.     # steps to redefine cd and the like.  Also note that ksh has
  29.     # no pushd and popd to redefine.
  30.     fake_cd() { cd $* ; cwdcmd ; }
  31.     alias cd=fake_cd
  32.  
  33.     ## Step D.
  34.     fake_rlogin() { rlogin $*; reorient ; }
  35.     alias rlogin='fake_rlogin '
  36.  
  37.     fake_sh() { sh $*; reorient ; }
  38.     alias sh=fake_sh
  39.  
  40.     fake_ksh() { ksh $*; reorient ; }
  41.     alias ksh=fake_ksh
  42.  
  43.     fake_csh() { csh $*; reorient ; }
  44.     alias csh=fake_csh
  45.  
  46.     fake_tcsh() { tcsh $*; reorient ; }
  47.     alias tcsh=fake_tcsh
  48.  
  49.     fake_zsh() { zsh $*; reorient ; }
  50.     alias zsh=fake_zsh
  51.  
  52.     fake_bash() { bash $*; reorient ; }
  53.     alias bash=fake_bash
  54.  
  55.     fake_tcl() { tcl $*; reorient ; }
  56.     alias tcl=fake_tcl
  57.  
  58.     ## Step E.
  59.     reorient
  60. fi
  61.