Annotation of researchv9/cmd/emacs/term_support, revision 1.1.1.1

1.1       root        1: The terminal support for EMACS is driven from a directory of terminal
                      2: type descriptions.  This directory contains one file (or link) for
                      3: each terminal type.  The file contains a set of lines of the form:
                      4: 
                      5:        parameter=value
                      6:        
                      7: EMACS comes with terminal type files to support many of the common types.
                      8: These are normally kept in the TERMINALS archive file and will be put
                      9: in the terminals sub-directory of the directory from which emacs is made
                     10: by the makefile.  You can change the makefile to change the location of
                     11: these files for your location.
                     12: 
                     13: If you wish to create your own private terminal file for emacs, you
                     14: can use it without installing it in the terminals directory by
                     15: setting your terminal type (either setting TERM or using M-t in
                     16: emacs) to the full pathname of the terminal file.
                     17: 
                     18: The best way to construct a new description is to start with a
                     19: description of a similar terminal and modify it.  You can find the
                     20: description of a particular terminal by reading
                     21: "~EMACS/terminals/name>" where name is the name of the terminal you
                     22: want to look at when in emacs.  (Don't type "emacs ~EMACS ... to the
                     23: shelll, run emacs and use ^X^R or ^X^F)
                     24: 
                     25: The terminal support is not the same as the termcap file used by vi.
                     26:        
                     27: The format that I have chosen is simple, easy to parse by both human
                     28: and machine, and easy to extend.  Each parameter is identified by a
                     29: two character code.  Those parameters that are exactly as in termcap
                     30: are named as so.
                     31: 
                     32: The format of the parameter values is quite simple, so as to allow
                     33: parsing with a simple, efficient, parser.  Parameters are either a
                     34: decimal number, starting with any digit, or are a string, starting
                     35: with anything else.  String parameters contain exactly the
                     36: characters desired (up to a newline).  The only mapping done on
                     37: string parameters is to map sequences starting with a backslash (\)
                     38: as follows:
                     39: 
                     40:        \n maps to a newline
                     41:        
                     42:        \(anything else) maps to the backslashed character.  (useful
                     43:        for backslashes or for parameters starting with digits. 
                     44: 
                     45: Notice that I do not map octal character specifications, or any of
                     46: the other commonly used character specifications.  The parameters
                     47: can appear in any order, and only those that apply to a particular
                     48: terminal should be specified.  String parameters contain a printf
                     49: style string to be sent to the terminal to produce the desired
                     50: effect.  Because printf strings are used, If you need to put a '%'
                     51: in a string parameter put two % characters (%%) to get a single % output.
                     52: 
                     53: The exact mappings used are similar to printf, with some
                     54: limitations.  The general format is: %nc, where n is an optional
                     55: field width (one or more ascii characters), and c is a character
                     56: specifier.  What is done depends on c as follows:
                     57: 
                     58: %%:    Print a single % sign
                     59: %c:    Print the next arg as a character
                     60: %o:    Print the next arg (an int) in octal, with width at least n.
                     61: %d:    Like o, only decimal
                     62: %p:    Print width milliseconds of pad characters.
                     63: %P:    Print width*region number of pad characters.  Region
                     64:        is the number of lines or characters in the region effected
                     65:        by the current command.
                     66: %m:    Print the substring in tm determined by the next arg. 
                     67:        Width*arg is used as an index into the string parameter "tm",
                     68:        (terminal map) and the next width characters are put out.
                     69:        This is an      "escape hatch", which allows you to specify the
                     70:        cursor positioning algorithm for any terminal not covered by the
                     71:        above mechanisms.  See the description of the "tm" parameter
                     72:        for more details.
                     73: %M:    Like %m above, except that the map is taken from the
                     74:        parameter "tM".   This is provided for terminals which need
                     75:        2 maps, one for horizantal and one for vertical.
                     76: 
                     77: The following parameters are available:
                     78: 
                     79: up=(string) move up one line
                     80: 
                     81: do=(string) move down one line
                     82: 
                     83: bc=(string) backward one character
                     84: 
                     85: nd=(string) forward one character  (use only if this is a single 
                     86:        character, otherwise omit)
                     87: 
                     88: cr=(string) carriage return without linefeed. (^M)
                     89: 
                     90: ho=(string) home (not currently used by emacs)
                     91: 
                     92: cl=(string) clear entire screen (from any position, 
                     93:        leaving cursor at home)
                     94: 
                     95: cd=(string) clear from here to end of screen (not currently used by emacs)
                     96: 
                     97: ce=(string) clear from cursor to end of line
                     98: 
                     99: bl=(string) ring the bell
                    100: 
                    101: cm=(string) absolute cursor addressing (a printf style character 
                    102:       string that will produce the correct escape sequence when
                    103:       evaluated with the row and column.)  see xbase and ybase.
                    104: 
                    105: ru=(string) relative up    (see relative cursor addressing below)
                    106: rd=(string) relative down  (see relative cursor addressing below)
                    107: rl=(string) relative left  (see relative cursor addressing below)
                    108: rr=(string) relative right (see relative cursor addressing below)
                    109: 
                    110: relative cursor addressing:
                    111:        same as cm (above) except moves the cursor relative
                    112:        to its current position.   This is meant for terminals like
                    113:        the Tektronix 4025 which have only relative cursor movement
                    114:        commands.  If you specify any of the relative
                    115:        values you must specify them all.  Don't specify both absolute
                    116:        (cm) and relative cursor positioning because EMACS will
                    117:        use absolute (cm) cursor positioning if both are specified.
                    118: 
                    119: tm=(string) Terminal Map.
                    120: tM=(string) Alternate Terminal Map.
                    121: 
                    122: Terminal maps.  These specify the output produced by %m or %M
                    123:        conversions in cursor positioning strings.
                    124:        A "terminal map" is used for terminals that use cursor
                    125:        positioning addresses that are not decimal or octal numbers.
                    126:        The "tm" and "tM" string are tables that EMACS will go into
                    127:        for cursor position addresses.
                    128:        As an example, suppose a terminal with a view width of 80 and
                    129:        a view height of 24.  Suppose also that the terminal accepts
                    130:        three digit decimal cursor addresses except that only even
                    131:        numbers are used.  EMACS will calculate cursor addresses in
                    132:        ranges of 00-23 and 00-79.  The terminal map would look like:
                    133:        tm=\000002004006008010...158
                    134:        (Note the leading zero must be backslashed to make this a
                    135:        character string.)
                    136:        The corresponding "cm" string   might look like:
                    137:        cm=^W%3m%3m
                    138:        If the number of position-dependent characters
                    139:        varies, null characters in tm should be used in tm to pad
                    140:        out shorter map entries.  (Real nulls to be output should be
                    141:        have the high order bit set (enter with M-q in EMACS)).
                    142: 
                    143: pc=(string) pad character.  (string containing a single character to be
                    144:        used for padding).
                    145: 
                    146: al=(string) insert line sequence  (see below).
                    147: 
                    148: dl=(string) delete line sequence   These two parameters are used to
                    149:        cause the screen to scroll selectively.  The insert line
                    150:        sequence is assumed to insert a single blank line at the
                    151:        line containing the cursor, and scroll the remaining lines
                    152:        on the  screen downward.  The delete line sequence is
                    153:        assumed to delete the current line, scrolling the remaining
                    154:        lines upward.)
                    155:        
                    156: AL=(string) like 'al' but inserts several lines with printf string.
                    157: 
                    158: DL=(string) like 'dl' but deletes several lines with printf string.
                    159: 
                    160: im=(string) enter insert character mode.  This function is assumed
                    161:        to put the terminal into insert character mode.  Insert
                    162:        character mode is assumed to push the character under the
                    163:        cursor and those beyond it to the right to accomodate new
                    164:        characters.  See the description of "in" for more
                    165:        information on what insert character is expected to do.
                    166: 
                    167: ic=(string) insert character sequence.   If the terminal has no
                    168:        insert character mode, but has a sequence that opens up one
                    169:        blank position at the cursor, specify it with ic, and leave
                    170:        im and ei blank.  For terminals that need to go into a mode
                    171:        to do inserts, and need a special sequence to open up each
                    172:        position, give both im and ic.
                    173:        
                    174: ip (string) Insert padding.  This string will be printed after every
                    175:        character inserted.  It should be a padding specification
                    176:        (%P or %p) to specify delay.  Note that you only need to
                    177:        specify this on a terminal that needs padding, and has an
                    178:        insert mode but no ic.  Otherwise, just put the padding into ic.
                    179: 
                    180: ei=(string)overwrite mode sequence (see above).
                    181: 
                    182: dc=(string)delete character sequence (the character sequence which
                    183:        deletes the character under the cursor and causes the remaining
                    184:        characters on the screen line to move over by one).
                    185: 
                    186: dm=(int) delete mode.  If absent or set to zero, emacs assumes that
                    187:        delete character and insert mode are independent and delete
                    188:        character can be done at any time.  If dm is set to 1, then
                    189:        emacs puts the terminal in insert mode before deleting
                    190:        characters.  This is needed, for example, on some datamedia
                    191:        and ann arbor terminals.  If dm is set to 2, then emacs
                    192:        makes sure that the terminal is not in insert mode before
                    193:        deleting characters.
                    194:        
                    195: in=(int) insert mode type.  If this is 0, insert and delete
                    196:        character are assumed to move all of the characters to the
                    197:        right of the curssor on the same line, like the adm31, and
                    198:        hp terminals.  If this is 1, then insert and delete are
                    199:        assumed to move every character in the rest of the display
                    200:        until a position that has not been written since the last
                    201:        clear is encountered, like the concept-100.
                    202:        
                    203: sf=(string) scroll sequence (the character sequence needed to scroll the
                    204:        screen with the cursor at the bottom.  NULL if the screen
                    205:        can't be scrolled simply.)
                    206:        
                    207: SF=(string) scroll several lines with printf sequence.
                    208: 
                    209: sr=(string) scroll in reverse (The character sequence needed to
                    210:        scroll the screen down when the cursor is at the top.  This
                    211:        is only used to scroll in a region with a terminal like the
                    212:        vt100.  This should be NULL if there is no such capability)
                    213:        
                    214: SR=(string) scroll reverse several lines with printf sequence.
                    215: 
                    216: cs=(string) Scrolling region sequence. If non null, this is a printf style
                    217:        string that will define the scrolling region on the screen
                    218:        when given the top and bottom lines (offset by xbase) as
                    219:        parameters.  The only known terminal which uses this feature
                    220:        is the vt100 and its relatives.  If cs is set sr, sf and cm
                    221:        must also be set.
                    222: 
                    223: vs=(string) initialization escape sequence needed to put terminal in the
                    224:        mode described by these parameters.
                    225:        
                    226: ve=(string) exit sequence.  If present, this sequence is printed
                    227:        whenever you exit from emacs to undo the effects of vs.  Vs
                    228:        will be printed whenever you enter emacs.
                    229:        
                    230: bx=(number) xbase.  offset to add to first cursor address parameter
                    231: 
                    232: by=(number) ybase.  offset to add to second cursor address parameter.  To
                    233:        accommodate the variety of cursor address escape sequences,
                    234:        the curad parameter is a printf string that when evaluated
                    235:        with the row and column positions, with xbase and ybase
                    236:        added to them, will move to the proper position.
                    237:        
                    238: rc=(number) 1 if cursor addressing is row and column, 0 if column and row.
                    239: 
                    240: co=(number) width of screen
                    241: 
                    242: li=(number) number of lines on screen
                    243: 
                    244: am=(number) 1 if cursor moves to next line after end of line, 0 otherwise
                    245: 
                    246: vc=(number) milliseconds of real time needed by terminal for insert/delete
                    247:        line sequence
                    248: 
                    249: ul= Underline (see below)
                    250: 
                    251: ue = End underline (see below)
                    252: 
                    253: eo = (see below)
                    254: 
                    255: Underscore processing.  relevant variables are 'eo', 'ul' and 'ue'.
                    256:        'eo' should be one if writing over an underlined position clears
                    257:        it, otherwise, make it zero, and emacs will clear the line to get
                    258:        rid of unwanted underscores.  'ul' is a string parameter that
                    259:        contains whatever is needed to print the character with an
                    260:        underline.  If the terminal underscores naturally, then 'ul' is
                    261:        %c<BS>_.  If the terminal has an underscore character mode,
                    262:        then 'ul' is underscore mode on and 'ue' is underscore mode
                    263:        off.  If  the terminal has an underscore single character
                    264:        command, then 'ul' is 'underscore character command' %c. 
                    265:        This is inefficient in underscoring giant blocks of text,
                    266:        but this should be rare. 
                    267:        
                    268:        If the terminal does not have underscore but does have reverse 
                    269:        video you may use reverse video for underscore. 
                    270:        
                    271: mi=(int) If this is set to 1, then emacs assumes that it can use the
                    272:        cursor movement capabilities such as up, bc, cm, etc. while
                    273:        the terminal is in insert mode.  If the parameters is
                    274:        missing or set to zero, emacs will take the terminal out of
                    275:        insert mode before doing any cursor motion.  On some
                    276:        terminals, the movement commands cause characters or lines
                    277:        to be inserted when sent in insert mode.
                    278: 
                    279: CM=(int) Terminal handles "compressed" output.  Emacs can be
                    280:        compiled with code to compress output sent to the terminal,
                    281:        using character codes with the eighth bit on to represent
                    282:        common multi-character sequences.  If you have a terminal
                    283:        that will interpret these and have it set up compatibly with
                    284:        emacs, this can be used.  I do not recommend it at this
                    285:        time.
                    286:        
                    287: Any escape sequence not available should be omitted.  emacs needs
                    288: clear and some form of cursor addressing (absolute or relative).
                    289: Emacs can use 'up', 'do' and either 'bc' or 'cr' rather than
                    290: cursor addressing (this often needed for PCs running as terminal
                    291: emulator) but it will be very slow.  Users with terminals or PCs
                    292: providing only these capabilities are strongly advised to obtain
                    293: better terminals or PC terminal emulators.
                    294: 
                    295: Other capabilities speed up the display or enhance what is
                    296: displayed, but are not strictly necessary.
                    297: 
                    298: The program ttest (made by "make ttest") can be used to test out a new
                    299: terminal description file.  The output is relatively self-explanatory.
                    300: 
                    301: 

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.