\section{Mode Control Flags}
\label{Mode Control Flags}

     TECO has flags which control various aspects  of  its  operation.
     You  can  find  a flag's current setting by executing its command
     name without an argument;  the current setting  of  the  flag  is
     returned  as  a  value.  A flag may be set to a specific value by
     executing its command name preceded by a numerical argument;  the
     flag is set to the value of the argument.

     The following table describes the commands  that  set  and  clear
     flags;  {\tt <flag>} represents any of the flags listed below.


\begin{table}[h]
\caption{\bf{Flag Manipulation Commands}}
\label{Flag Manipulation Commands}
\end{table}
\nopagebreak

\begin{list}{}{\labelsep 20pt}

     \item[{\tt <flag>}]         Return value of flag.

     \item[{\tt n<flag>}]        Set value of flag to {\tt n}.

     \item[{\tt m,n<flag>}]      In the flag, turn off those bits  specified  
				by  {\tt m}
                	    and turn on those bits specified by {\tt n}.

     \item[{\tt 0,n<flag>}]      Turn on the bits in the flag specified by 
				{\tt n}.

     \item[{\tt m,0<flag>}]      Turn off the bits in the flag specified by 
				{\tt m}.
\end{list}

     The flags have the following functions:


\begin{list}{ Mode Control Flags}{\labelsep 20pt}

     \item[{\em COMMAND}]             {\em FUNCTION}

     \item[{\tt ED}]        The edit level flag, a bit-encoded word  that  controls
               TECO's  behavior  in various respects.  Any combination
               of the individual bits may be set as the user sees fit.
               The bits have the following functions:

	\begin{list}{}{\labelsep 10pt}

               \item[{\tt ED\&1}]      Allow caret (\caret ) in search 
			strings.   If  this
                         bit  is clear, a caret (\caret ) in a search string
                         modifies the immediately following  character
                         to become a control character.  When this bit
                         is set, a caret in a search string is  simply
                         the  literal  character  caret.   If  you are
                         editing  a  file  that  contains  many  caret
                         characters  (e.g.,  a  RUNOFF  file with case
                         control), you will  want  to  set  this  bit.
                         (For  control of upper/lower case matching in
                         search strings, see the \caret{\tt X} flag.)

               \item[{\tt ED\&2}]      Allow all {\tt Y} and \_ commands.  If this  
			bit  is
                         set,  the  {\tt Y} (Yank) command and \_ (underscore
                         or backarrow) command work unconditionally as
                         described  earlier  in the manual.  If clear,
                         the behavior of the  {\tt Y}  and  \_  commands  are
                         modified  as  follows:   If an output file is
                         open and text exists in the text buffer,  the
                         {\tt Y}  or \_ command will produce an error message
                         and the command will be aborted  leaving  the
                         text  buffer  unchanged.   Note  that  if  no
                         output file is open the {\tt Y} and \_ commands  act
                         normally.  Furthermore, if the text buffer is
                         empty the {\tt Y} command can be used to bring in a
                         page of text whether or not an output file is
                         open ({\tt HKY} will always work).  The  \_  command
                         will  succeed  in  bringing  one page of text
                         into an empty text buffer but  will  fail  to
                         bring  in  successive pages if an output file
                         is open.

               \item[{\tt ED\&4}]      When this bit is  clear,  TECO  will  try  to
                         expand  memory  as much as it can in order to
                         try to fit  entire  pages  into  memory  when
                         requested  to  do  so.   If  this bit is set,
                         arbitrary memory expansion  will  not  occur.
                         In that case, TECO will expand memory only on
                         the {\tt A} command and not  on  the  {\tt Y}, 
				{\tt P},  or  {\tt N}
                         commands.   This bit is always set in TECO-10
                         and has  no  significance  in  TECO-8  or  in
                         TECO-11 on RT-11.

               \item[{\tt ED\&8}]      Reserved for future use by TECO-8.

\ifnotintecoeight
               \item[{\tt ED\&16}]     Allow failing searches to preserve  dot.   If
                         this  bit  is  set,  then  whenever  a search
                         fails, the  original  location  of  the  text
                         buffer  pointer  will  be preserved.  If this
                         bit is clear, then  failing  searches  (other
                         than  bounded searches) leave the text buffer
                         pointer at  pointer  position  0  after  they
                         fail.
                         {\em [not in TECO-8]}
\fi

	% \iftecoeleventrue
\iftecoelevenonly
               \item[{\tt ED\&32}]     Enable  immediate  ESCape-sequence  commands.
                         If  this  bit  is set, TECO will recognize an
                         ESCape-sequence key pressed immediately after
                         the   prompting   asterisk  as  an  immediate
                         command.  See section 
			\ref{Immediate ESCAPE-Sequence Commands} for  a  
			description
                         of immediate ESCape-sequence commands.

                         If this bit is clear (the default case), TECO
                         will  treat  an  ESCape coming in immediately
                         after the asterisk prompt as a  {\tt <DELIM>}  That
                         is,   TECO   will   hear   a  discrete  {\tt <ESC>}
                         character:  an ESCape sequence will therefore
                         be treated not as a unified command, but as a
                         sequence of characters.
                         {\em [TECO-11 only]}

               \item[{\tt ED\&64}]     Only move dot by one on  multiple  
		occurrence
                         searches.   If this bit is clear, TECO treats
                         {\tt nStext}\escape  exactly   as   
			{\tt n<1Stext} \escape. That is, skip over the
			whole matched search string when proceeding to
			the $n$th search match. For example, if the text
			buffer contains only {\tt A}'s, the command
			{\tt 5SAA}\escape will complete with {\em dot} equal
			to ten ({\em 10}). 

			If this bit is set, TECO increments {\em dot} by
			one each search match. In the example above,
			{\em dot} would become five ({\em 5}).
			{\em[TECO-11 only]}

               \item[{\tt ED\&128}]    Automatic refresh inhibit.  
		If scroll mode is
                         enabled  (that  is, if {\tt 7:W} is non-zero), TECO
                         normally refreshes the  text  buffer  display
                         just  before  printing its {\tt *} prompt.  Setting
                         the 128 bit in  {\tt ED}  inhibits  this  automatic
                         refresh.   (Inhibiting  the automatic refresh
                         may  be  useful  when  running  over  a  slow
                         terminal  line;   see  also  the \caret {\tt W}
			 immediate command.)
                         {\em [TECO-11 only]}

               \item[{\tt ED\&128}]    Automatic refresh inhibit.  
		If scroll mode is
                         enabled  (that  is, if {\tt 7:W} is non-zero), TECO
                         normally refreshes the  text  buffer  display
                         just  before  printing its {\tt *} prompt.  Setting
                         the {\em 128} bit in  {\tt ED}  inhibits  this  
			automatic
                         refresh.   (Inhibiting  the automatic refresh
                         may  be  useful  when  running  over  a  slow
                         terminal  line;   see  also  the \caret {\tt W} 
		immediate
                         command.)
                         {\em [TECO-11 only]}
\fi

               The initial value of  {tt ED\&1}  is  system  dependent  (See
               appendices).   The  initial  value of the other bits in
               the {\tt ED} flag is 0.
	\end{list}

	% \ifrstsetrue
     \item[{\tt EE}]        This flag is initially zero, and (unless  the  
		8192  {\tt ET}
               bit  is  set)  TECO  recognizes  only the ESCape as its
               {\tt <DELIM>} character from the console.  If it  is  desired
               to  use  another  character  as an ESCape surrogate (as
               when working from a terminal lacking  an  ESCape  key),
               the  ASCII  value of that other character may be set in
               the {\tt EE} flag.  Note that when  an  ESCape  surrogate  is
               set,  the  designated  character  (when  typed  at  the
               console) is received by  TECO  as  an  ESCape  --  that
               character  is  no  longer  directly  available  at  the
               keyboard.  When  an  ESCape  surrogate  is  active,  an
               ESCape  received  by  TECO echos as accent grave;  when
               none is active, an ESCape received  by  TECO  echos  as
               dollar  sign.  This feature is provided for the benefit
               of newer terminals which lack an ESCape  key.   ({\tt 8192ET}
               and  {\tt 96EE} both set \escape as ESCape surrogate.  
		{\tt EE}, however,
               can be used to designate a character other than  accent
               grave.)
               {\em [RSTS/E only]}
	% \fi

     \item[{\tt EH}]        The help level flag, which  controls  the  
	printing  of
               error  messages  and  failed commands.  (See also the {\tt /}
               command.)

	\begin{list}{}{\labelsep 20pt}

               \item[{\tt EH\&3}]      The low two bits of {\tt EH} 
			(value range 0 through
                         3)   control   the  printing  of  TECO  error
                         messages as follows  (assuming  the  low  two
                         bits have value {\tt m}):

                         If {\tt m} is equal to 1, error messages are output
                         in  abbreviated form ({\tt ?XXX}).  If m is equal
                         to 2, error messages  are  output  in  normal
                         form  ({\tt ?XXX  Message}).  If {\tt m} is equal to 3,
                         error messages are output in long or {\em War and
                         Peace}   form,   that   is,  a  paragraph  of
                         informative material is typed  following  the
                         normal   form   of  the  error  message.   In
                         TECO-11, {\tt m}=3 is implemented only on  VAX/VMS.
                         (See  section  \ref{VMS Help} for a description of HELP
                         facilities available on  VAX/VMS.)  In  other
                         TECO-11's, case {\tt m}=3 is equivalent to {\tt m}=2.

               \item[{\tt EH\&4}]      If this bit of {\tt EH} is set, the 
			failing command
                         is  also  output  up  to  and  including  the
                         failing character in the command followed  by
                         a  question mark.  (Just like TECO's response
                         to the typing of a question mark  immediately
                         after an error.) This bit is not supported by
                         TECO-10.

	\end{list}

               The initial  value  of  the  EH  flag  is  0  which  is
               equivalent to a value of 2.


\iftecotenonly
     \item[{\tt EO}]        Setting the value of the {\tt EO} flag to 
		{\tt n}  allows  features
               that were peculiar to that version of TECO to work.
               {\em [TECO-10 only]}
\fi

\ifnotintecoeight
     \item[{\tt ES}]        The search verification flag, which controls  
	the  text
               typed out after searches.

               If {\tt n}  is  equal  to  0,  nothing  is  typed  out  after
               searches.   If  {\tt n}  is -1, the current line is typed out
               when a successful search  at  top  level  is  completed
               (i.e.,  a  {\tt V}  command  is done automatically).  If 
		{\tt n} is
               between 1 and 31, the current line is typed out with  a
               line  feed  immediately  following  the position of the
               pointer to identify its position.  If {\tt n} is  between  32
               and  126,  the current line is typed out with the ASCII
               character corresponding to the value of  {\tt n}  immediately
               following  the  position of the pointer to identify its
               position.  If you want to see more  than  one  line  of
               type  out,  use the form {\em m*256+n}.  The {\tt n} is 
		the same as
               above.  The {\tt m} is the number  of  lines  of  view.   For
               example, {\tt 3*256+^^!}  would give two lines on either side
               of  the  found  line,  and  the  found  line  with  the
               character  {\tt !}  at the pointer's position.  The {\tt ES} flag
               does not apply to searches executed  inside  iterations
               or macros;  lines found inside iterations or macros are
               never typed out.
               {\em [Not in TECO-8]}
\fi

               The initial value of ES is 0.

     \item[{\tt ET}]        The {\tt ET} flag is a bit-encoded  word  controlling  TECO's
               treatment  of the console terminal.  Any combination of
               the individual bits may be set.  The bits  provide  the
               following functions, when set:

	\begin{list}{}{\labelsep 10pt}

               \item[{\tt ET\&1 }]      Type out in image  mode.   Setting  this  bit
                         inhibits  all of TECO's type out conversions.
                         All characters are  output  to  the  terminal
                         exactly  as  they  appear in the buffer or 
			\caret{\tt A}
                         command.   For  example,  the   changing   of
                         control characters into the {\tt caret/character}
                         form, and the conversion  of  {\tt <ESCAPE>}  to  
			\escape
                         (accent  grave)  or  to  {\tt \$}  (dollar sign) are
                         suppressed.  This mode is useful for  driving
                         displays.   It  should  be used with caution,
                         especially if you are talking to TECO over  a
                         dial-up line.

               \item[{\tt ET\&2 }]      Process  {\tt <DELETE>}s  and  
			{\tt <CTRL/U>}s  in  ``scope''
                         mode.   Scope mode processing uses the cursor
                         control features of  CRT  type  terminals  to
                         handle character deletion by actually erasing
                         characters from the screen.

               \item[{\tt ET\&4 }]      Read lower case.  TECO normally converts  all
                         lower  case  alphabetics  to  upper  case  on
                         input.  Setting this bit  causes  lower  case
                         alphabetics  to be input as lower case.  TECO
                         commands and file specifiers may be typed  in
                         either  upper or lower case.  For the purpose
                         of searches, however, upper  and  lower  case
                         may be treated as different characters.  (See
                         \caret{\tt X} flag).

               \item[{\tt ET\&8 }]      Read without  echo  for  
			\caret{\tt T}  commands.   This
                         allows  data  to  be  read  by the 
			\caret{\tt T} command
                         without having the  characters  echo  at  the
                         terminal.   Normal command input to TECO will
                         echo.

               \item[{\tt ET\&16 }]     Cancel {\tt <CTRL/O>} on type  out.   
			Setting  this
                         bit will cancel any outstanding {\tt <CTRL/O>} when
                         the next type out  occurs.   After  TECO  has
                         canceled  the {\tt <CTRL/O>}, it will automatically
                         clear the bit.

               \item[{\tt ET\&32 }]     Read with  no  wait.   This  
			enables  the  \caret{\tt T}
                         command  to  test if a character is available
                         at the user terminal.   If  a  character  has
                         been  typed,  \caret{\tt T}  returns  the  value  of the
                         character as always.   If  no  character  has
                         been typed, \caret{\tt T} immediately returns a value of
                         -1 and execution  continues  without  waiting
                         for a character.

               \item[{\tt ET\&64 }]     Detach flag (See appendices).

               \item[{\tt ET\&128 }]    {\em Abort-on-error} bit.   Initially  
			set,  when
                         TECO  starts  up;   cleared  each  time  TECO
                         issues its asterisk prompt.  When this bit is
                         set:    1) all   informational  messages  are
                         supressed,   2) any   {\tt <CTRL/C>}   causes   the
                         immediate  termination  of  TECO,  and 3) any
                         error causes the termination  of  TECO  after
                         the error message is printed.

               \item[{\tt ET\&256 }]    If this bit is set, all lines output  to  the
                         terminal  are  truncated  to  the  terminal's
                         width  if  needed.   (RSTS/E,   RSX-11,   and
                         VAX/VMS  only.  On VAX/VMS, this bit reflects
                         and can change  the  state  of  the  terminal
                         characteristic  WRAP/NOWRAP;   TECO  restores
                         the terminal characteristic to  its  original
                         state upon exit.)

               \item[{\tt ET\&512 }]    If this bit is set, the scope {\em WATCH} feature
                         of  TECO  is  present  and your terminal is a
                         scope type terminal.  This bit is a read-only
                         bit;   its  state  cannot  be  altered.  (See
                         Section \ref{Scope Commands}.)

               \item[{\tt ET\&1024 }]   If this bit is set, the refresh scope {\em WATCH}
                         feature  of  TECO  is  present  and a refresh
                         scope is available.  This bit is a  read-only
                         bit;   its  state  cannot  be  altered.  (See
                         Section \ref{Scope Commands}.)

               \item[{\tt ET\&4096 }]   This bit reflects and can change the state of
                         the  terminal  characteristic  (maintained by
                         the operating system) recording  whether  the
                         terminal  is  capable  of  handling eight-bit
                         character codes.  Upon entry  to  TECO,  this
                         bit  reflects  the characteristic as recorded
                         with the operating system at that  time.   If
                         you  change this bit, the operating system is
                         directed  to  change  its  recording  of  the
                         characteristic to match.

                         Because the data manipulated (edited) by TECO
                         can  consist  of all 256 possible byte codes,
                         the way data characters are displayed  (typed
                         out) at the console varies depending upon the
                         setting of the 4096 {\tt ET} bit.

                         If  the  bit  is  clear  (meaning  that  TECO
                         understands your terminal to be 7-bit), valid
                         DEC multi-national codes  are  typed  out  as
                         {\tt <xy>}  (where  {\tt xy}  is  the corresponding 
				LK201
                         keyboard compose sequence).

                         If  the  bit  is  set  (meaning   that   TECO
                         understands your terminal to be 8-bit), valid
                         DEC multi-national codes  are  typed  out  as
                         themselves.

                         In either case, unprintable or illegal  codes
                         in the 128 to 255 range are typed out as 
				{\tt [ab]}
                         (where {\tt ab} is  the  corresponding  hexadecimal
                         code).    The  scope  watch  feature  (screen
                         buffer display, controlled by the W commands)
                         always uses the {\tt <xy>} and {\tt [ab]} notations.


\iftecoelevenonly
               \item[{\tt ET\&8192 }]   Accent grave as ESCape surrogate.

                         If this bit is set,  TECO  recognizes  the  \escape
                         (accent   grave)   character   as  an  ESCAPE
                         surrogate.  That is, an \escape character typed  at
                         the  console  will be recognized as a command
                         {\tt <DELIM>} character, and passed to TECO  as  an
                         ESCape.  (This interpretation applies only to
                         {\tt <DELIM>}s  typed  at  the   console;    ESCape
                         characters  must  still be used in macros and
                         indirect files.) When an ESCape surrogate  is
                         set,  an  ESCape  received  by  TECO echos as
                         accent grave;  when none is  set,  an  ESCape
                         received  by TECO echos as dollar sign.  This
                         feature  is  provided  for  the  benefit   of
                         certain  newer terminals which lack an ESCape
                         key.  (See also the Introduction, and the  EE
                         flag.) {\em [TECO-11 only]}
\fi

               \item[{\tt ET\&32768 }]  If this bit is set and a 
			{\tt <CTRL/C>}  is  typed,
                         the  bit  is turned off, but execution of the
                         current  command   string   is   allowed   to
                         continue.  This allows a TECO macro to detect
                         typed {\tt <CTRL/C>}s.
                         In TECO-8, this bit is the 2048's bit  rather
                         than the 32768's bit.
	\end{list}

               The initial setting of {\tt ET} is operating system dependent
               (See appendices).  In addition, some of the {\tt ET} bits are
               automatically turned off by certain error conditions.

     \item[{\tt EU}]        The upper/lower case flag.

               If {\tt n} is -1, no case flagging of any type  is  performed
               on  type out, lower case characters are output as lower
               case characters.  If {\tt n} is 0, lower case characters  are
               flagged by outputting a ' (quote) before the lower case
               character and the lower case  character  is  output  in
               upper case;  upper case characters are unchanged.  If {\tt n}
               is +1, upper case characters are flagged by  outputting
               a  '  (quote)  before  each one and then the upper case
               character is output;  lower case characters are  output
               as their upper case equivalents.

               The initial value of the {\tt EU} flag is -1 if TECO can tell
               from  the  operating  system  that  the user's terminal
               supports display of lower case  characters;   otherwise
               te initial value is 0.  Consult the appendices for more
               details.

\iftecoelevenonly
     \item[{\tt EV}]        The edit verify flag is decoded just like the 
		{\tt ES}  flag.
               Just before TECO prints its prompting {\tt *}, the {\tt EV}
		 flag is
               checked.  If it is non-zero the lines to be viewed  are
               printed on the terminal.

               The initial value of the {\tt EV} flag is 0.
               {\em [TECO-11 only]}
\fi

\ifnotintecoeight
     \item[\caret {\tt X}]        The search mode flag.
               {\em [Not in TECO-8]}

               If \caret{\tt X} is 0, the text argument in a search command  will
               match  text  in  the text buffer independent of case in
               either the search argument or  the  text  buffer.   The
               lower   case   alphabetics   match   the   upper   case
               alphabetics, and \escape , {\tt \{},{\tt \}},  \squiggle , 
		match  {\tt @},
               {\tt [},  {\tt \bs },  {\tt ]},  \caret   respectively.   In addition, DEC
               multinational characters having diacritical  marks  are
               regarded   as  matching  the  corresponding  characters
               without diacritical marks.

               If \caret{\tt X} is -1, the search will succeed only if  the  text
               argument  is  identical  to  text  in  the text buffer.
               (This means that lower case does NOT match upper  case,
               nor  does  a  character having a diacritical mark match
               one without).
               The initial value of the \caret{\tt X} flag is 0.  (For control of
               caret  or  uparrow treatment in search strings, see the
               {\tt ED\&1} bit above.)
\fi
\end{list}
