### Copyright (C) 1995-1997 Jesper K. Pedersen
### This program is free software; you can redistribute it and/or modify
### it under the terms of the GNU General Public License as published by
### the Free Software Foundation; either version 2 of the License, or
### (at your option) any later version.
###
### This program is distributed in the hope that it will be useful,
### but WITHOUT ANY WARRANTY; without even the implied warranty of
### MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
### GNU General Public License for more details.
###
### You should have received a copy of the GNU General Public License
### along with this program; if not, write to the Free Software
### Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.


proc misc {} {
  # misc

  Desc "And here's the bucket for all those things I don't know where to place"

  ShortDesc misc

  ############################### Widgets ##############################
  CheckBox nobeep \
      -text "Use audio bell" 
  
  CheckBox nokanji \
      -text "Avoid using Kanji"

  CheckBox quote \
      -text "always let backslash quote \\, \" and '" 
  
  Line l1
  promptWidget {%history%\\t%time%24 hour%0%\\t%R%\\n} {"scheduled event" "Event" {This is the scheduled event.}} {{Format of sched output}
      {This is the format in which the sched builtin command print.
	See the tcsh manual for more information on scheduled event.}}
  Line l2

  Entry editor \
      -text "Name of your default editor"
  Entry visual \
      -text "Name of your default full screen editor"
  Entry pager \
      -text "Name of your default text browser"
  

  Line l3

  Menu correct \
      -text "Spell check" \
      -entries {none command all "none, but complete automatically"}


  ################################ Help ################################
  Help nobeep \
      "If you are tired of beeps all the time, then this might"\
      "be the right option to set."

  Help nokanji \
      "If this option is selected and the shell supports Kanji"\
      "(see the version shell variable), it is disabled so that the"\
      "meta key can be used."

  Help quote \
      "If this option is set then backslash will always quote these"\
      "three characters, even if it is inside quotes, where no"\
      "substitution otherwise.\n\nExample:\nOption unset: echo '\\\"'"\
      "will give \\\"\noption set: echo '\\\"' will give \""

  Help correct "Tcsh can check whether your commands exists or"\
      "not. This is called spell check. Ie. if you type \"lz file\""\
      "tcsh will see that it doesn't know of a command called lz, and"\
      "it will suggest a command which match the command you've typed,"\
      "which in this case is \"ls\"."
  EntryHelp correct none "No spell check is done at all"
  EntryHelp correct command "The command, which is the first word on"\
      "the line, is spell checked."
  EntryHelp correct all "The whole command line is spell checked."
  EntryHelp correct "none, but complete automatically" \
      "If this option is selected, then completion is done"\
      "automatically, when enter is hit, eg. if you type \"dotf\" and"\
      "hit enter then \"dotf\" is automatically completed to"\
      "\"dotfile\" and executed."

  ################################ Save ################################
  Save {
    ########## nobeep ##########
    if {!$nobeep || $generateDefault} {
      print "[pick $nobeep unset set] nobeep"
    }
    ########## nokanji ##########
    if {$nokanji || $generateDefault} {
      print "[pick $nokanji set unset] nokanji"
    }
    ########## backslash_quote ##########
    if {$quote || $generateDefault} {
      print "[pick $quote set unset] backslash_quote"
    }
    ########## sched ##########
    if {$prompt != "%h\\t%T\\t%R\\n" || $generateDefault} {
      if {$prompt != "%h\\t%T\\t%R\\n"} {
	print "set sched = \"$prompt\""
      }
    }
    ########## EDITOR ##########
    if {$editor != "" || $generateDefault} {
      if {$editor != ""} {
	print "setenv EDITOR $editor"
      } else {
	print "unsetenv EDITOR"
      }
    }
    ########## VISUAL ##########
    if {$visual != "" || $generateDefault} {
      if {$visual != ""} {
	print "setenv VISUAL $visual"
      } else {
	print "unsetenv VISUAL"
      }
    }
    ########## PAGER ##########
    if {$pager != "" || $generateDefault} {
      if {$pager != ""} {
	print "setenv PAGER $pager"
      } else {
	print "unsetenv PAGER"
      }
    }
    ########## correct ##########
    if {$correct(index) != 0 || $generateDefault} {
      switch $correct(index) {
	0 {print "unset correct"}
	1 {print "set correct = cmd"}
	2 {print "set correct = all"}
	3 {print "set correct = complete"}
      }
    }
  }
}
