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-tclrc < prev    next >
Encoding:
Text File  |  1993-03-06  |  1.8 KB  |  57 lines

  1. # This file should be edited in -*- tcl -*- mode;
  2. # $Id: dot-tclrc,v 1.0 1993/03/07 04:42:04 jct Exp $
  3.  
  4. ## This file contains a sample script showing how to set up the tcl
  5. ## shell to work properly with j-shell.  Before examining this script,
  6. ## please read the comments in the file dot-tcsh; the comments in that
  7. ## script describe steps common to the scripts for all shells.
  8.  
  9. # Comments delimited by a single # are specific to tcl.
  10.  
  11. if {$env(TERM) == "emacs"} {
  12.   
  13.   ## Step A omitted.
  14.   
  15.   ## Step B.
  16.   # I don't know what's considered "good" tcl coding style, but I'm
  17.   # probably breaking it by concatting the short functions into a
  18.   # single line.
  19.   proc cwdcmd {} { echo "\033EmAcScd" [pwd]; }
  20.   proc hostcmd {} { echo "\033EmAcShost" [exec hostname]; }
  21.   proc reorient {} { hostcmd; cwdcmd; }
  22.   
  23.   ## Step C.
  24.   # Check to see whether the chdir command exists; if it does, then
  25.   # assume it does what we need and don't attempt to rename cd.  This
  26.   # is primarily so this script won't break cd should we happen to
  27.   # source it twice.
  28.   if {[info commands chdir] == ""} { rename cd chdir; }
  29.  
  30.   # Define cd
  31.   proc cd {{dir ""}} {
  32.     global env;
  33.     if {$dir == ""} {
  34.       chdir $env(HOME);
  35.     } else {
  36.       chdir $dir;
  37.     }
  38.     reorient;
  39.   }
  40.  
  41.   # Don't need to worry about pushd and popd--they call cd, so we're
  42.   # covered.
  43.  
  44.   ## Step D.
  45.   proc rlogin    {args} { system [concat rlogin $args]; reorient; }
  46.   proc sh    {args} { system [concat sh $args]; reorient; }
  47.   proc ksh    {args} { system [concat ksh $args]; reorient; }
  48.   proc csh    {args} { system [concat csh $args]; reorient; }
  49.   proc tcsh    {args} { system [concat tcsh $args]; reorient; }
  50.   proc zsh    {args} { system [concat zsh $args]; reorient; }
  51.   proc bash    {args} { system [concat bash $args]; reorient; }
  52.   proc tcl    {args} { system [concat tcl $args]; reorient; }
  53.  
  54.   # Step E.
  55.   reorient;
  56. }
  57.