home *** CD-ROM | disk | FTP | other *** search
/ Gold Fish 3 / goldfish_volume_3.bin / files / util / edit / jade / man / jade.info-9 < prev    next >
Encoding:
GNU Info File  |  1994-10-16  |  48.4 KB  |  1,308 lines

  1. This is Info file jade.info, produced by Makeinfo-1.55 from the input
  2. file jade.texi.
  3.  
  4. START-INFO-DIR-ENTRY
  5. * Jade: (jade).            An editor for X11 and AmigaDOS
  6. END-INFO-DIR-ENTRY
  7.  
  8.    This is Edition 1.3, last updated 7 October 1994, of `The Jade
  9. Manual', for Jade, Version 3.2.
  10.  
  11.    Jade is a text editor for X11 (on Unix) and the Amiga.
  12.  
  13.    Copyright 1993, 1994 John Harper.
  14.  
  15.    Permission is granted to make and distribute verbatim copies of this
  16. manual provided the copyright notice and this permission notice are
  17. preserved on all copies.
  18.  
  19.    Permission is granted to copy and distribute modified versions of
  20. this manual under the conditions for verbatim copying, provided that
  21. the entire resulting derived work is distributed under the terms of a
  22. permission notice identical to this one.
  23.  
  24. 
  25. File: jade.info,  Node: Indentation Functions,  Next: Translation Functions,  Prev: Transpose Functions,  Up: Text
  26.  
  27. Indentation Functions
  28. ---------------------
  29.  
  30.  - Function: indent-pos &optional POS BUFFER
  31.      This function returns the *glyph* position (*note Glyph
  32.      Positions::.) of the first character in the line pointed to by POS
  33.      (or the cursor) which is not a TAB or SPC character.
  34.  
  35.  - Function: set-indent-pos INDENT-POS &optional BUFFER ONLY-SPACES
  36.      Sets the indentation of the line pointed to by POS to the column
  37.      pointed to by POS by putting the optimal sequence of TAB and SPC
  38.      characters at the start of the line.
  39.  
  40.      If the ONLY-SPACES argument is non-`nil' no TAB characters will be
  41.      used.
  42.  
  43.  - Command: indent-to COLUMN &optional ONLY-SPACES
  44.      This function inserts enough TAB and SPC characters to move the
  45.      cursor to glyph column COLUMN.
  46.  
  47.      If the ONLY-SPACES argument is non-`nil' no TAB characters are
  48.      used.
  49.  
  50.      Note that COLUMN counts from zero.
  51.  
  52.      When called interactively the COLUMN argument is either the
  53.      numeric value of the prefix argument or, if no prefix argument has
  54.      been entered, the result of prompting for a number.
  55.  
  56.  - Command: tab-with-spaces
  57.      This command inserts enough spaces at the cursor position to move
  58.      the cursor to the next tab stop.
  59.  
  60.    Some major modes provide their own method of indentation (for example
  61. Lisp mode will indent Lisp programs in the proper style), see *Note
  62. Mode-Specific Indentation::.
  63.  
  64.  - Command: indent-line
  65.      If the current buffer has a method for indentation installed, use
  66.      it to indent the current line to its correct depth.
  67.  
  68.  - Command: newline-and-indent
  69.      Insert a newline character, then indent the new line; if no
  70.      function for indenting lines has been installed in this buffer a
  71.      single TAB character is inserted.
  72.  
  73.  - Command: indent-area START-POS END-POS
  74.      Uses the buffer's indentation method to indent all lines in the
  75.      specified region to their correct depth.
  76.  
  77.      When called interactively the currently-marked block is used to
  78.      get the values of the two arguments, the block is then unmarked.
  79.  
  80. 
  81. File: jade.info,  Node: Translation Functions,  Next: Search and Match Functions,  Prev: Indentation Functions,  Up: Text
  82.  
  83. Translation Functions
  84. ---------------------
  85.  
  86.  - Function: translate-area START-POS END-POS TRANSLATION-TABLE
  87.           &optional BUFFER
  88.      This function applies the mapping TRANSLATION-TABLE to each
  89.      character in the region starting at the position START-POS up to,
  90.      but not including, END-POS.
  91.  
  92.      TRANSLATION-TABLE is a string, each character represents the
  93.      mapping for an ASCII character of that character's position in the
  94.      string. If the string is less than 256 characters in length any
  95.      undefined characters will remain unchanged (i.e. a
  96.      TRANSLATION-TABLE of `' would leave the region unaltered).
  97.  
  98.  - Function: translate-string STRING TRANSLATION-TABLE
  99.      This function uses a similar method to that used in the
  100.      `translate-area' function. Instead of applying the mapping to a
  101.      region of a buffer it applies it to the string STRING. STRING is
  102.      returned (after being modified).
  103.  
  104.      Note that the STRING really is modified, no copy is made!
  105.  
  106.           (translate-string "abc" upcase-table)
  107.               => "ABC"
  108.  
  109.  - Variable: upcase-table
  110.      This is a 256-character long string which may be used as a
  111.      translation table to convert from lower-case to upper-case with
  112.      the functions `translate-string' and `translate-area'.
  113.  
  114.  - Variable: downcase-table
  115.      Similar to `upcase-table' except that it is used to convert from
  116.      upper-case to lower-case.
  117.  
  118.    The following functions use the translation functions and the two
  119. translation tables described above.
  120.  
  121.  - Command: upcase-area START-POS END-POS &optional BUFFER
  122.      Makes all alphabetic characters in the specified region of text
  123.      upper-case.
  124.  
  125.      When called interactively uses the block marks for its arguments;
  126.      note that this won't work properly with rectangular blocks.
  127.  
  128.  - Command: downcase-area START-POS END-POS &optional BUFFER
  129.      Similar to `upcase-area' but makes all alphabetic characters
  130.      lower-case.
  131.  
  132.  - Command: upcase-word COUNT
  133.      For the next COUNT words starting at the cursor position, make
  134.      their alphabetic characters upper-case.
  135.  
  136.  - Command: downcase-word COUNT
  137.      Does the opposite of `upcase-word', makes words lower-case!
  138.  
  139.  - Command: capitalize-word
  140.      The first character of this word (normally the one under the
  141.      cursor) is made upper-case, the rest lower.
  142.  
  143. 
  144. File: jade.info,  Node: Search and Match Functions,  Next: Rectangular Editing,  Prev: Translation Functions,  Up: Text
  145.  
  146. Searching and Matching Functions
  147. --------------------------------
  148.  
  149.    The most powerful of the searching and matching functions are those
  150. using regular expressions, for details of the regexp syntax used by
  151. Jade see *Note Regular Expressions::.
  152.  
  153.    Note that the regexp matcher *does not work across lines*, at the
  154. moment no regexp may span more than one line. Also the regexp routines
  155. choke on NUL bytes; hopefully I'll correct these problems soon...
  156.  
  157. * Menu:
  158.  
  159. * Searching Buffers::           Scanning buffers for something
  160. * String Matching::             Matching regexps to text
  161. * Replacing Strings::           Replacing a found string or regexp with
  162.                                   something else
  163. * Regexp Functions::            General regexp utility functions
  164.  
  165. 
  166. File: jade.info,  Node: Searching Buffers,  Next: String Matching,  Up: Search and Match Functions
  167.  
  168. Searching Buffers
  169. .................
  170.  
  171.  - Function: find-next-regexp REGEXP &optional POS BUFFER IGNORE-CASE
  172.      This function returns the position of the next substring in the
  173.      buffer matching the regular expression string REGEXP. It starts
  174.      searching at POS, or the cursor position if POS is undefined.
  175.  
  176.      If no match of the regexp occurs before the end of the buffer `nil'
  177.      is returned.
  178.  
  179.      If the IGNORE-CASE argument is non-`nil' then the case of matched
  180.      strings is ignored (note that character ranges are still
  181.      case-significant).
  182.  
  183.  - Function: find-prev-regexp REGEXP &optional POS BUFFER IGNORE-CASE
  184.      Similar to `find-next-regexp' except this searches in the opposite
  185.      direction, from POS (or the cursor) to the *start* of the buffer.
  186.  
  187.  - Function: find-next-string STRING &optional POS BUFFER
  188.      Scans forwards from POS (or the cursor), in BUFFER (or the current
  189.      buffer), looking for a match with the string STRING. Returns the
  190.      position of the next match or `nil'.
  191.  
  192.      Note that matches can't span more than one line.
  193.  
  194.  - Function: find-prev-string STRING &optional POS BUFFER
  195.      A backwards-searching version of `find-next-string'.
  196.  
  197.  - Function: find-next-char CHARACTER &optional POS BUFFER
  198.      Search forwards for an occurrence of the character CHARACTER and
  199.      returns its position, or `nil' if no occurrence exists.
  200.  
  201.  - Function: find-prev-char CHARACTER &optional POS BUFFER
  202.      This function searches backwards for an occurrence of the character
  203.      CHARACTER.
  204.  
  205. 
  206. File: jade.info,  Node: String Matching,  Next: Replacing Strings,  Prev: Searching Buffers,  Up: Search and Match Functions
  207.  
  208. String Matching
  209. ...............
  210.  
  211.  - Function: looking-at REGEXP &optional POS BUFFER IGNORE-CASE
  212.      Returns `t' if the regular expression REGEXP matches the text at
  213.      position POS in the buffer BUFFER (or the current buffer).
  214.  
  215.      Only the text from POS to the end of the line is matched against.
  216.  
  217.  - Function: regexp-match REGEXP STRING &optional IGNORE-CASE
  218.      This function returns `t' if the regular expression REGEXP matches
  219.      the string STRING.
  220.  
  221.      Note that the match is unanchored so if you want test for a match
  222.      of the whole of STRING use the `^' and `$' regexp meta-characters.
  223.      For example,
  224.  
  225.           (regexp-match "(a|b)+" "fooabababar")
  226.               => t
  227.           
  228.           (regexp-match "^(a|b)+$" "fooabababar")
  229.               => nil
  230.           
  231.           (regexp-match "^(a|b)+$" "ababbabba")
  232.               => t
  233.  
  234.      When the IGNORE-CASE argument is non-`nil' the case of strings
  235.      being matched is insignificant (except in character ranges).
  236.  
  237.  - Function: regexp-expand REGEXP STRING TEMPLATE &optional IGNORE-CASE
  238.      This function matches the regular expression REGEXP against the
  239.      string STRING, if the match is successful a string is created by
  240.      expanding the template string TEMPLATE.
  241.  
  242.      For details of what meta-characters are allowed in TEMPLATE see
  243.      *Note Regular Expressions::.
  244.  
  245.           (regexp-expand "^([a-z]+):([0-9]+)$"
  246.                          "foobar:42"
  247.                          "The \\1 is \\2.")
  248.               => "The foobar is 42."
  249.  
  250.  - Function: regexp-match-line REGEXP &optional LINE-POS BUFFER
  251.           IGNORE-CASE
  252.      This function is similar to `regexp-match', instead of explicitly
  253.      supplying the string to match against it is one whole line of the
  254.      specified buffer, the line pointed to by LINE-POS (or the line
  255.      that the cursor is on).
  256.  
  257.      `t' is returned if the match is successful.
  258.  
  259.  - Function: regexp-expand-line REGEXP TEMPLATE &optional LINE-POS
  260.           BUFFER IGNORE-CASE
  261.      As `regexp-match-line' is similar to `regexp-match', this function
  262.      is similar to `regexp-expand'.
  263.  
  264.      The whole of the line at the position LINE-POS (or the cursor) is
  265.      matched with the regular expression REGEXP. If the match is
  266.      successful the TEMPLATE is used to expand a string which is
  267.      returned.
  268.  
  269. 
  270. File: jade.info,  Node: Replacing Strings,  Next: Regexp Functions,  Prev: String Matching,  Up: Search and Match Functions
  271.  
  272. Replacing Strings
  273. .................
  274.  
  275.  - Function: replace-regexp REGEXP TEMPLATE &optional POS BUFFER
  276.           IGNORE-CASE
  277.      If a substring of the buffer at POS (or the cursor) matches the
  278.      regular expression REGEXP the text that matched is replaced with
  279.      the result of expanding the template string TEMPLATE.
  280.  
  281.      For details about templates see *Note Regular Expressions::.
  282.  
  283.      `nil' is returned if the match failed, and therefore no replacement
  284.      occurred.
  285.  
  286.  - Function: replace-string OLD-STRING NEW-STRING &optional POS BUFFER
  287.      If a substring of the buffer at POS (or the cursor) matches the
  288.      string OLD-STRING it is replaced by the string NEW-STRING.
  289.  
  290.      If the match fails `nil' is returned, otherwise some non-`nil'
  291.      value.
  292.  
  293. 
  294. File: jade.info,  Node: Regexp Functions,  Prev: Replacing Strings,  Up: Search and Match Functions
  295.  
  296. Regexp Functions
  297. ................
  298.  
  299.    It is often useful to construct regular expressions by concatenating
  300. several strings together; the problem with doing this is you may not
  301. know if a string contains any characters which the regexp compiler
  302. reacts specially to (i.e. `*', `|', ...). Obviously these characters
  303. should be protected by a backslash, the following function will do this
  304. for you.
  305.  
  306.  - Function: regexp-quote STRING
  307.      This function returns a new version of the string STRING, any
  308.      characters in STRING which are regexp meta-characters are quoted
  309.      with a backslash.
  310.  
  311.      If the string contains no meta-characters the original string is
  312.      returned, without being copied.
  313.  
  314.           (regexp-quote "foo*bar+baz")
  315.               => "foo\\*bar\\+baz"
  316.  
  317.      Note that in the above example the backslashes in the returned
  318.      string are only single backslashes; the print functions print a
  319.      single backslash character as `\\' so they can be read back in.
  320.  
  321.      This function is usually used when a part of a regexp being
  322.      constructed is unknown at compile time, often provided by the user.
  323.  
  324.    As the section describing regexp syntax notes, the strings that
  325. parenthesised expressions match are recorded, the following two
  326. functions allow Lisp programs to access the positions of these strings.
  327.  
  328.  - Function: match-start &optional EXPRESSION-INDEX
  329.      This function returns the position which the parenthesised
  330.      expression number EXPRESSION-INDEX started at in the last
  331.      successful regexp match.
  332.  
  333.      If EXPRESSION-INDEX is `nil' or zero the start of the whole string
  334.      matched is returned instead.
  335.  
  336.      The returned value will either be a position object if the last
  337.      match was in a buffer, or an integer if the last match was in a
  338.      string (i.e.  `regexp-match').
  339.  
  340.           (regexp-match "foo(bar)" "xyzfoobarsaalsd")
  341.               => t
  342.           (match-start)
  343.               => 3
  344.           (match-start 1)
  345.               => 6
  346.  
  347.  - Function: match-end &optional EXPRESSION-INDEX
  348.      Return the position which the parenthesised expression number
  349.      EXPRESSION-INDEX ended at in the last successful regexp match.
  350.  
  351.      If EXPRESSION-INDEX is `nil' or zero the end of the whole match is
  352.      returned instead.
  353.  
  354.      The returned value will either be a position object if the last
  355.      match was in a buffer, or an integer if the last match was in a
  356.      string (i.e.  `regexp-match').
  357.  
  358.           (regexp-match "foo(bar)" "xyzfoobarsaalsd")
  359.               => t
  360.           (match-end)
  361.               => 9
  362.           (match-end 1)
  363.               => 9
  364.  
  365. 
  366. File: jade.info,  Node: Rectangular Editing,  Next: Controlling Undo,  Prev: Search and Match Functions,  Up: Text
  367.  
  368. Rectangular Editing
  369. -------------------
  370.  
  371.    These functions are used to manipulate rectangular regions of
  372. buffers. Two position objects are used to define a rectangle, these
  373. represent opposite corners of the rectangle. Note that the corner on
  374. the right hand side of the rectangle specifies the column *after* the
  375. last column included in the rectangle.
  376.  
  377.  - Function: delete-rect START-POS END-POS &optional BUFFER
  378.      This function deletes a rectangle, defined by START-POS and
  379.      END-POS, from the specified buffer.
  380.  
  381.  - Function: copy-rect START-POS END-POS &optional BUFFER
  382.      Returns a string containing the rectangle of text defined by the
  383.      two positions START-POS and END-POS. Any TAB characters are
  384.      expanded to SPC characters, newline characters mark the end of
  385.      each line in the rectangle.
  386.  
  387.  - Function: cut-rect START-POS END-POS &optional BUFFER
  388.      A combination of the `copy-rect' and `delete-rect' functions; it
  389.      makes a copy of the rectangle's contents which is returned after
  390.      the rectangle is deleted from the buffer.
  391.  
  392.  - Command: insert-rect STRING &optional POS BUFFER
  393.      Inserts the string STRING into the buffer at the specified
  394.      position, treating STRING as a rectangle of text. This means that
  395.      each successive line of STRING (separated by newline characters)
  396.      is inserted at the *same* column in successive lines.
  397.  
  398.      If the end of the buffer is reached and there is still some of the
  399.      string left to insert extra lines are created at the end of the
  400.      buffer.
  401.  
  402.  - Command: yank-rectangle &optional DONT-YANK-BLOCK
  403.      This function is similar to the `yank' function (*note Insertion
  404.      Functions::.), except that it uses the `insert-rect' function to
  405.      insert the piece of text.
  406.  
  407. 
  408. File: jade.info,  Node: Controlling Undo,  Next: Misc Text Functions,  Prev: Rectangular Editing,  Up: Text
  409.  
  410. Controlling Undo
  411. ----------------
  412.  
  413.    For the description of one part of controlling the undo feature, the
  414. maximum size of the undo-list, see *Note Undo::.
  415.  
  416.  - Variable: buffer-record-undo
  417.      A buffer-local variable which, when set to `nil', stops any
  418.      undo-information being recorded for the buffer.
  419.  
  420.      When a buffer is created, this variable is always set to `t'.
  421.  
  422.  - Variable: buffer-undo-list
  423.      This buffer-local variable stores the actual list of
  424.      undo-information; each element defines one modification to the
  425.      buffer.
  426.  
  427.      Don't try to be clever and access the contents of this list; the
  428.      structure may well change in future revisions of Jade.
  429.  
  430.      The only thing you're allowed to do is set it to `nil', this clears
  431.      all undo-information for the buffer.
  432.  
  433.  - Command: undo
  434.      Undo every change to the contents of the buffer back to the
  435.      previous command. Successive calls to this command work backwards
  436.      through the buffer's undo-list.
  437.  
  438. 
  439. File: jade.info,  Node: Misc Text Functions,  Prev: Controlling Undo,  Up: Text
  440.  
  441. Miscellaneous Text Functions
  442. ----------------------------
  443.  
  444.  - Function: empty-line-p &optional POS BUFFER
  445.      This function returns `t' if the line pointed to by POS (or by the
  446.      cursor) consists totally of TAB or SPC characters.
  447.  
  448. 
  449. File: jade.info,  Node: Writing Modes,  Next: Prompting,  Prev: Text,  Up: Programming Jade
  450.  
  451. Writing Modes
  452. =============
  453.  
  454.    Modes are used to customise individual buffers so that the text it
  455. contains can be edited in a special way. Each buffer has a single
  456. "Major mode", tailoring the buffer to the type of file contained in it
  457. (i.e. C source code uses `c-mode'). *Note Editing Modes::.
  458.  
  459.    "Minor modes" provide individual features which may be enabled and
  460. disabled individually, each buffer may have any number of minor modes
  461. enabled at once. *Note Minor Modes::.
  462.  
  463. * Menu:
  464.  
  465. * Writing Major Modes::         How to define a new major mode
  466. * Installing Modes::            Functions and variables used to
  467.                                   install major modes in buffers
  468. * Writing Minor Modes::         Minor modes are totally different
  469.                                   to major modes
  470. * Mode-Specific Indentation::   Each major mode may define its own
  471.                                   method of indentation,
  472. * Mode-Specific Expressions::     expression handling,
  473. * Mode-Specific Comments::        and comment insertion.
  474.  
  475. 
  476. File: jade.info,  Node: Writing Major Modes,  Next: Installing Modes,  Up: Writing Modes
  477.  
  478. Writing Major Modes
  479. -------------------
  480.  
  481.    Each major mode must define a command whose name ends in `-mode'
  482. (i.e. `c-mode', `lisp-mode', etc...). This command is called when the
  483. major mode is to be installed in the current buffer. It's first action
  484. *must* be to check for an already installed mode and remove it. The
  485. following code fragment does this,
  486.  
  487.      (when major-mode-kill
  488.        (funcall major-mode-kill))
  489.  
  490.    *All* major modes must do this!
  491.  
  492.    Now the major mode is free to install itself; generally this will
  493. entail setting the buffer-local values of the `mode-name', `major-mode',
  494. `major-mode-kill' and `keymap-path' variables. For example the
  495. `lisp-mode' sets these variables as follows,
  496.  
  497.      (setq mode-name "Lisp"
  498.            major-mode 'lisp-mode
  499.            major-mode-kill 'lisp-mode-kill
  500.            keymap-path (cons 'lisp-mode-keymap keymap-path))
  501.  
  502. Note how the major mode's own keymap (with all the mode's local key
  503. bindings installed in it) is consed onto the front of the
  504. `keymap-path'; this ensures that mode-local bindings take precedence
  505. over bindings in the global keymaps.
  506.  
  507.    After installing itself a major mode should call a hook (generally
  508. called `X-mode-hook' where X is the name of the mode) to allow
  509. customisation of the mode itself.
  510.  
  511.    The `major-mode-kill' variable holds a function to be called when the
  512. major mode is to be removed from the current buffer; basically it should
  513. remove its keymap and set all the mode-local variables to `nil'.  For
  514. example the `lisp-mode-kill' function does the following to negate the
  515. effects of the code fragment above,
  516.  
  517.      (setq keymap-path (delq 'lisp-mode-keymap keymap-path)
  518.            major-mode nil
  519.            major-mode-kill nil
  520.            mode-name nil)
  521.  
  522.  - Variable: major-mode
  523.      This buffer-local variable contains the symbol whose function
  524.      definition was used to install the buffer's major mode (i.e.
  525.      `c-mode', etc...).
  526.  
  527.      When it is `nil' the buffer uses the `generic' mode; this is simply
  528.      the bog standard editor.
  529.  
  530.  - Variable: major-mode-kill
  531.      This buffer-local variable contains the function which should be
  532.      called to remove the buffer's currently installed major-mode.
  533.  
  534.      Note that the `kill-buffer' function calls this (if it's non-`nil')
  535.      just before destroying a buffer; so if necessary, an error
  536.      signalled within this function will prevent a buffer being killed.
  537.  
  538.  - Variable: mode-name
  539.      A buffer-local variable containing the `pretty' name of the
  540.      buffer's major mode, a string which will be printed in the status
  541.      line.
  542.  
  543.    Many modes bind commands to keys with the prefix `Ctrl-c', to save
  544. each mode creating a new root keymap the buffer-local variable
  545. `ctrl-c-keymap' exists.
  546.  
  547.  - Variable: ctrl-c-keymap
  548.      This buffer-local variable can be used by major modes to hang their
  549.      keymap for the `Ctrl-c' prefix from. Simply set this variable to
  550.      the keymap your mode wants to be installed after a `Ctrl-c' prefix.
  551.  
  552.    The definitions for many different types of modes can be found in
  553. Jade's lisp directory.
  554.  
  555. 
  556. File: jade.info,  Node: Installing Modes,  Next: Writing Minor Modes,  Prev: Writing Major Modes,  Up: Writing Modes
  557.  
  558. Installing Modes
  559. ----------------
  560.  
  561.    Before a major mode can be used to edit a buffer with it must be
  562. installed in that buffer. The most straightforward method of doing this
  563. is simply to invoke the mode's command which does this (i.e. `c-mode').
  564.  
  565.    It could be a bit annoying to have to this every time a new buffer is
  566. created so the `mode-alist' variable allows major modes to be installed
  567. automatically, when the buffer is opened.
  568.  
  569.  - Function: init-mode BUFFER &optional STRING
  570.      This function attempts to install a major mode into BUFFER. If the
  571.      `major-mode' variable is non-`nil' it defines the function to call
  572.      to install the mode; this function will be called.
  573.  
  574.      Otherwise the `mode-alist' variable is searched; each regular
  575.      expression is matched against a string, when a match occurs the
  576.      associated function is called to install the mode.
  577.  
  578.      The string matched against is defined by the first of the following
  579.      choices which is not `nil' or undefined.
  580.  
  581.        1. The value of the optional STRING argument.
  582.  
  583.        2. The word specified on the first line of the buffer bracketed
  584.           by the string `-*-'. For example if the first line contained
  585.           the string `-*-Text-*-' the string `Text' would be used.
  586.  
  587.        3. The value of the variable mode-name.
  588.  
  589.        4. The name of the file being edited in the buffer.
  590.  
  591.      Note that each match is case-insensitive.
  592.  
  593.  - Variable: mode-alist
  594.      An association list (*note Association Lists::.) defining regular
  595.      expressions which associate with a particular major mode.
  596.  
  597.      When the `init-mode' function matches a regular expression to the
  598.      string it is using to find the mode for the buffer the associated
  599.      mode is installed.
  600.  
  601.      For example, `mode-alist' could be,
  602.  
  603.           (("\\.(c|h)$|^c(|-mode)$" . c-mode)
  604.            ("\\.jl$|^lisp(|-mode)$" . lisp-mode)
  605.            ("\\.(text|doc|txt|article|letter)$" . text-mode)
  606.            ("^(text(|-mode)|(.*/|)draft)$" . text-mode)
  607.            ("^indented-text(|-mode)$" . indented-text-mode)
  608.            ("\\.[s]$|^asm(|-mode)$" . asm-mode)
  609.            ("\\.[S]$|^asm-cpp(|-mode)$" . asm-cpp-mode)
  610.            ("\\.texi(|nfo)|^texinfo(|-mode)$" . texinfo-mode))
  611.  
  612.  - Function: kill-mode &optional BUFFER
  613.      This function removes the major mode currently installed in the
  614.      specified buffer.
  615.  
  616. 
  617. File: jade.info,  Node: Writing Minor Modes,  Next: Mode-Specific Indentation,  Prev: Installing Modes,  Up: Writing Modes
  618.  
  619. Writing Minor Modes
  620. -------------------
  621.  
  622.    Minor modes are generally harder to write properly than major modes
  623. since they have to peacefully coexist with all the other minor modes
  624. which may also be enabled in a buffer.
  625.  
  626.    Generally each minor mode maintains a buffer-local variable saying
  627. whether or not it's installed in the buffer. The minor mode's function
  628. usually toggles the mode on or off depending on the state of this
  629. variable.
  630.  
  631.    There are two functions which *must* be used to install and remove a
  632. minor mode -- `add-minor-mode' and `remove-minor-mode', see their
  633. documentation for details.
  634.  
  635.    Each buffer has a keymap containing the bindings of all the minor
  636. modes enabled in the buffer (the variable `minor-mode-keymap'). These
  637. bindings have to be added when the mode is enabled and removed when it
  638. is disabled.
  639.  
  640.  - Variable: minor-mode-list
  641.      This buffer-local variable is a list of all the minor modes
  642.      enabled in a buffer.
  643.  
  644.  - Variable: minor-mode-names
  645.      This buffer-local variable contains a list of strings, each string
  646.      names one of the minor modes currently enabled in the buffer.
  647.  
  648.  - Variable: minor-mode-keymap
  649.      A buffer-local keymap to be used by minor-modes. This is only
  650.      created the first time a minor mode calls `add-minor-mode' in the
  651.      buffer.
  652.  
  653.  - Function: add-minor-mode MODE NAME &optional NO-KEYMAP
  654.      This function installs a minor mode (the symbol MODE) into the
  655.      current buffer. All minor modes should call this before doing
  656.      anything drastic.
  657.  
  658.      NAME is the string to be displayed in the status line as the name
  659.      of this minor mode.
  660.  
  661.      When NO-KEYMAP is `nil' or undefined this function ensures that
  662.      the `minor-mode-keymap' variable has a valid value in this buffer.
  663.  
  664.  - Function: remove-minor-mode MODE NAME
  665.      Removes a minor mode from the current buffer, the MODE and NAME
  666.      arguments must have the same value as the arguments given to
  667.      `add-minor-mode' when the mode was enabled.
  668.  
  669.    The following code fragment is an example minor mode taken from
  670. Jade's source code.
  671.  
  672.      (provide 'fill-mode)
  673.      
  674.      (defvar fill-column 72
  675.        "Position at which the text filling commands break lines.")
  676.      
  677.      (defvar fill-mode-p nil)
  678.      (make-variable-buffer-local 'fill-mode-p)
  679.      
  680.      ;;;###autoload
  681.      (defun fill-mode ()
  682.        "Minor mode for automatically filling lines, i.e. word-wrapping.
  683.      This makes the SPC key checks if the cursor is past the fill-column. If
  684.      so, the next line is started."
  685.        (interactive)
  686.        (if fill-mode-p
  687.            (progn
  688.              (setq fill-mode-p nil)
  689.              (remove-minor-mode 'fill-mode "Fill")
  690.              (unbind-keys minor-mode-keymap "SPC"))
  691.          (add-minor-mode 'fill-mode "Fill")
  692.          (setq fill-mode-p t)
  693.          (bind-keys minor-mode-keymap
  694.            "SPC" 'fill-mode-spc)))
  695.      
  696.      (defun fill-mode-spc ()
  697.        (interactive)
  698.        (when (> (pos-col (cursor-pos)) fill-column)
  699.          (let
  700.              ((pos (cursor-pos)))
  701.            (set-pos-col pos (1+ fill-column))
  702.            (setq pos (unless (word-start pos) (forward-word -1 pos)))
  703.            (insert "\n" pos)
  704.            (let
  705.                ((end (left-char 1 (copy-pos pos))))
  706.              (when (equal (get-char end) ?\ )
  707.                (delete-area end pos)))))
  708.        (insert " "))
  709.  
  710. 
  711. File: jade.info,  Node: Mode-Specific Indentation,  Next: Mode-Specific Expressions,  Prev: Writing Minor Modes,  Up: Writing Modes
  712.  
  713. Mode-Specific Indentation
  714. -------------------------
  715.  
  716.    Some major modes provide functions which manage the indentation of
  717. the buffer they are installed in. These modes are usually those which
  718. are designed for a particular programming language; for example C mode
  719. understands how to indent C source and Lisp mode knows about Lisp code.
  720.  
  721.    To simplify matters there is a unified interface to the indentation
  722. process; each major mode simply sets the value of a buffer-local
  723. variable to the function used to indent a line in that buffer. This
  724. variable is then referenced by the functions which provide indentation.
  725.  
  726.  - Variable: mode-indent-line
  727.      This buffer-local variable should contain a function when the
  728.      buffer's major mode provides special indentation.
  729.  
  730.      The function should take one optional argument, the position of
  731.      the line to indent. If the value of this argument is `nil' the
  732.      current line should be indented. The function should set the
  733.      indentation of the line to the correct depth then return the glyph
  734.      position (*note Glyph Positions::.) of the first non-whitespace
  735.      character.
  736.  
  737.      For example Lisp mode sets this variable to `lisp-indent-line',
  738.      this function is defined as,
  739.  
  740.           (defun lisp-indent-line (&optional pos)
  741.             (set-indent-pos (lisp-indent-pos (or pos (cursor-pos)))))
  742.  
  743.      Where the function `lisp-indent-pos' calculates the proper
  744.      indentation for the line pointed to by its argument.
  745.  
  746.    For the functions dealing with indentation see *Note Indentation
  747. Functions::.
  748.  
  749. 
  750. File: jade.info,  Node: Mode-Specific Expressions,  Next: Mode-Specific Comments,  Prev: Mode-Specific Indentation,  Up: Writing Modes
  751.  
  752. Mode-Specific Expressions
  753. -------------------------
  754.  
  755.    Most programming use the concept of an "expression", Jade allows
  756. major modes to define two functions which define the syntax of an
  757. expression in a particular programming language. Commands exist which
  758. use these functions to allow the manipulation of expressions as
  759. entities in a buffer, much like words.
  760.  
  761.  - Variable: mode-forward-exp
  762.      This buffer-local variable contains a function which calculates the
  763.      position of the end of an expression in that language.
  764.  
  765.      The lambda-list of the function (i.e. its arguments) must be
  766.      `(&optional COUNT POS)'. COUNT is the number of expressions to
  767.      move forwards over (default is one), POS is the position to start
  768.      from (default is the cursor position).
  769.  
  770.      The function should return the position of the character following
  771.      the end of COUNT expressions starting from POS.
  772.  
  773.  - Variable: mode-backward-exp
  774.      Similar to `mode-forward-exp' but works backwards from the
  775.      character after the expression (at POS) to the start of the
  776.      previous COUNT expressions.
  777.  
  778.    These functions can often be quite complex but their structure is
  779. usually the same; these two examples are taken from the Lisp mode,
  780.  
  781.      (defun lisp-forward-sexp (&optional number pos)
  782.        "Return the position of the NUMBER'th next s-expression from POS."
  783.        (unless number
  784.          (setq number 1))
  785.        (while (> number 0)
  786.          ;; Move `pos' over one expression
  787.          ...
  788.          (setq number (1- number)))
  789.        pos)
  790.      
  791.      (defun lisp-backward-sexp (&optional number orig-pos)
  792.        "Return the position of the NUMBER'th previous s-expression
  793.      from ORIG-POS."
  794.        (unless number
  795.          (setq number 1))
  796.        (unless orig-pos
  797.          (setq orig-pos (cursor-pos)))
  798.        (let
  799.            ((pos (copy-pos orig-pos)))
  800.          (while (> number 0)
  801.             ;; Move `pos' backwards over one expression
  802.             ...
  803.            (setq number (1- number)))
  804.          pos))
  805.  
  806. 
  807. File: jade.info,  Node: Mode-Specific Comments,  Prev: Mode-Specific Expressions,  Up: Writing Modes
  808.  
  809. Mode-Specific Comments
  810. ----------------------
  811.  
  812.    When you wish to enter a comment in a piece of source code Jade has
  813. a command to do this (`insert-comment'); each major mode which wishes
  814. to allow comments (created by this command) must give the following
  815. variable a suitable function.
  816.  
  817.  - Variable: mode-comment-fun
  818.      This buffer-local variable contains the function to call when a
  819.      comment is to be entered, basically the `insert-comment' command
  820.      just calls this function.
  821.  
  822.  - Function: find-comment-pos
  823.      This function moves the cursor to a suitable position for inserting
  824.      a comment in the current line.
  825.  
  826.  - Variable: comment-column
  827.      Buffer-local variable containing the canonical column number which
  828.      comments should begin at (used by the `find-comment-pos' function).
  829.      If the line extends past this column the next tab stop after the
  830.      end of the line is used instead.
  831.  
  832.    The following function is an example of what is needed in the
  833. `mode-comment-fun' variable; it is used by the C mode.
  834.  
  835.      (defun c-insert-comment ()
  836.        (interactive)
  837.        (find-comment-pos)
  838.        (insert "/*  */")
  839.        (goto-left-char 3))
  840.  
  841. 
  842. File: jade.info,  Node: Prompting,  Next: Files,  Prev: Writing Modes,  Up: Programming Jade
  843.  
  844. Prompting
  845. =========
  846.  
  847.    The most common way to ask the user for a response is to encode the
  848. question in the command's interactive declaration (*note Interactive
  849. Declarations::.), sometimes this is inconvenient; functions are
  850. available which have the same effect as the code letters in an
  851. interactive declaration.
  852.  
  853.    The following two functions don't have an equivalent code for the
  854. interactive declaration.
  855.  
  856.  - Function: y-or-n-p QUESTION
  857.      This function prompts the user for a single key response to the
  858.      string QUESTION asking a question which can be answered yes or no.
  859.  
  860.      Returns `t' when QUESTION is answered with a `y' and `nil' when
  861.      `n' is typed.
  862.  
  863.  - Function: yes-or-no-p QUESTION
  864.      Similar to `y-or-n-p' but the answer must be either the word `yes'
  865.      or the word `no' entered in full. This function should be used when
  866.      a mistyped answer could be catastrophic (i.e. losing changes to a
  867.      buffer).
  868.  
  869.      Returns `t' for `yes', `nil' for anything else.
  870.  
  871.    The following functions are the functions used by the `call-command'
  872. function to resolve interactive arguments.
  873.  
  874.    Note that these function don't return the string entered (except for
  875. `prompt-for-string') -- they return some Lisp object which the string
  876. entered represents somehow.
  877.  
  878.  - Function: prompt-for-file &optional PROMPT EXISTING START
  879.      Prompts for the name of a file. PROMPT is the string to display at
  880.      the head of the prompt, when EXISTING is non-`nil' only files
  881.      which actually exist are allowed to be entered. The START argument
  882.      may be a string defining the starting contents of the prompt.
  883.  
  884.  - Function: prompt-for-directory &optional PROMPT EXISTING START
  885.      Prompts for the name of a directory, all arguments are similar to
  886.      in the `prompt-for-file' function.
  887.  
  888.  - Function: prompt-for-buffer &optional PROMPT EXISTING DEFAULT
  889.      This function prompts for a buffer object, if EXISTING is non-`nil'
  890.      the buffer selected must exist, otherwise the buffer will be
  891.      created if it doesn't already exist. DEFAULT is the value to
  892.      return if the user enters the null string, if `nil' the current
  893.      buffer is returned.
  894.  
  895.      Note that this returns the *actual buffer*, not its name as a
  896.      string.
  897.  
  898.  - Function: prompt-for-symbol &optional PROMPT PREDICATE
  899.      Prompt for a symbol, PROMPT is displayed at the head of the prompt
  900.      buffer. If the PREDICATE argument is defined it is a predicate
  901.      function; only symbols which when applied to the function PREDICATE
  902.      return non-`nil' will be allowed to be entered.
  903.  
  904.  - Function: prompt-for-lisp &optional PROMPT
  905.      Prompt for and return a Lisp object.
  906.  
  907.  - Function: prompt-for-function &optional PROMPT
  908.      Prompts for a function.
  909.  
  910.           (prompt-for-function PROMPT)
  911.           ==
  912.           (prompt-for-symbol PROMPT 'functionp)
  913.  
  914.  - Function: prompt-for-variable &optional PROMPT
  915.      Prompts for a variable (a symbol whose value is not void).
  916.  
  917.           (prompt-for-variable PROMPT)
  918.           ==
  919.           (prompt-for-symbol PROMPT 'boundp)
  920.  
  921.  - Function: prompt-for-command &optional PROMPT
  922.      Prompts for a command (a function which may be called
  923.      interactively).
  924.  
  925.           (prompt-for-command PROMPT)
  926.           ==
  927.           (prompt-for-symbol PROMPT 'commandp)
  928.  
  929.  - Function: prompt-for-string &optional PROMPT
  930.      Prompt for a string, whatever string is entered is returned as-is.
  931.  
  932.  - Function: prompt-for-number &optional PROMPT
  933.      Prompts for a number which is then returned.
  934.  
  935.    The following function is useful when a number of options have to be
  936. chosen between, for example the menu command in Info-mode uses this
  937. function.
  938.  
  939.  - Function: prompt-from-list OPTION-LIST PROMPT &optional START
  940.      Returns a selected choice from the list of options (strings)
  941.      OPTION-LIST. PROMPT is the title displayed, START the optional
  942.      starting choice.
  943.  
  944. 
  945. File: jade.info,  Node: Files,  Next: Processes,  Prev: Prompting,  Up: Programming Jade
  946.  
  947. Files
  948. =====
  949.  
  950.    Jade allows you to manipulate files in the operating system's filing
  951. system; a special type of Lisp object, a "file object", is used to
  952. represent files which have been opened for reading or writing (through
  953. the streams mechanism, *note Streams::.).
  954.  
  955.    Names of files are represented by strings, the syntax of file names
  956. is defined by the underlying operating system: Jade simply treats it as
  957. a string.
  958.  
  959. * Menu:
  960.  
  961. * File Names::                  Files are named by a string
  962. * File Objects::                Lisp objects representing files
  963. * File Information::            Predicates on files
  964. * Manipulating Files::          Deleting, renaming and copying files
  965. * Reading Directories::         Getting a list of the files in a directory
  966. * Reading and Writing Files::   Accessing the contents of a file in one go
  967.  
  968. 
  969. File: jade.info,  Node: File Names,  Next: File Objects,  Up: Files
  970.  
  971. File Names
  972. ----------
  973.  
  974.    A "file name" is a string identifying an individual file (or
  975. directory) in the filing system (i.e. the disk). The exact syntax of
  976. file names depends on the operating system.
  977.  
  978.  - Function: file-name-directory FILE-NAME
  979.      This function returns the directory part of the file name string
  980.      FILE-NAME.  This is the substring of FILE-NAME defining the
  981.      directory containing the file.
  982.  
  983.           (file-name-directory "/tmp/foo")
  984.               => "/tmp/"
  985.           
  986.           (file-name-directory "foo")
  987.               => ""
  988.           
  989.           (file-name-directory "foo/bar/")
  990.               => "/foo/bar/"
  991.  
  992.  - Function: file-name-nondirectory FILE-NAME
  993.      Returns the substring of the file name FILE-NAME which is *not*
  994.      the directory part.
  995.  
  996.           (file-name-nondirectory "/tmp/foo")
  997.               => "foo"
  998.           
  999.           (file-name-nondirectory "foo")
  1000.               => "foo"
  1001.           
  1002.           (file-name-nondirectory "foo/bar/")
  1003.               => ""
  1004.  
  1005.  - Function: file-name-concat &rest PARTS
  1006.      This function returns a file name constructed by concatenating
  1007.      each of the PARTS of the file name together. Each part is
  1008.      separated by the necessary string (i.e. `/' on Unix) when
  1009.      necessary. Note that each part may contain more than one component
  1010.      of the file name.
  1011.  
  1012.           (file-name-concat "/tmp" "foo" "bar")
  1013.               => "/tmp/foo/bar"
  1014.           
  1015.           (file-name-concat "/tmp/" "foo/" "bar")
  1016.               => "/tmp/foo/bar"
  1017.           
  1018.           (file-name-concat "/tmp/foo" "bar")
  1019.               => "/tmp/foo/bar"
  1020.  
  1021.  - Function: expand-file-name FILE-NAME &optional MAKE-ABSOLUTE
  1022.      This function expands the string FILE-NAME into a valid file name.
  1023.      Currently it only checks for a leading tilde character (`~') when
  1024.      running on Unix, if one is found it's expanded to the user's home
  1025.      directory.
  1026.  
  1027.      When the optional argument MAKE-ABSOLUTE is non-`nil' FILE-NAME is
  1028.      altered so that it is not relative to the current working
  1029.      directory.  Generally this involves prefixing it by the absolute
  1030.      name of the current directory.
  1031.  
  1032.           (expand-file-name "~/src")
  1033.               => "/home/jsh/src"
  1034.           
  1035.           (expand-file-name "foo.c" t)
  1036.               => "/var/src/jade/foo.c"
  1037.  
  1038.  - Function: tmp-file-name
  1039.      This function returns the name of a file which, when created, may
  1040.      be used for temporary storage. Each time this function is called a
  1041.      unique name is computed.
  1042.  
  1043.           (tmp-file-name)
  1044.               => "/tmp/00088aaa"
  1045.           
  1046.           (tmp-file-name)
  1047.               => "/tmp/00088baa"
  1048.  
  1049. 
  1050. File: jade.info,  Node: File Objects,  Next: File Information,  Prev: File Names,  Up: Files
  1051.  
  1052. File Objects
  1053. ------------
  1054.  
  1055.    A file object is a Lisp object which represents a file in the filing
  1056. system. Any file object may be used as a stream (either input or output)
  1057. to access the contents of the file serially, *Note Streams::.
  1058.  
  1059. * Menu:
  1060.  
  1061. * Creating File Objects::       Opening files
  1062. * Destroying File Objects::     Closing files
  1063. * File Object Predicates::      Predicates for file objects
  1064. * Functions on File Objects::   Functions operating on file objects
  1065.  
  1066. 
  1067. File: jade.info,  Node: Creating File Objects,  Next: Destroying File Objects,  Up: File Objects
  1068.  
  1069. Creating File Objects
  1070. .....................
  1071.  
  1072.  - Function: open FILE-NAME MODE-STRING &optional FILE-OBJECT
  1073.      This function opens the file called FILE-NAME (*note File Names::.)
  1074.      and returns the file's object.
  1075.  
  1076.      The MODE-STRING argument is a string defining the access modes used
  1077.      to open the file with; this string is passed as-is to the C
  1078.      library's `fopen()' function. Usually one of the following strings
  1079.      is used,
  1080.  
  1081.     `r'
  1082.           Open an existing file for reading only.
  1083.  
  1084.     `w'
  1085.           Open the file for writing only, if the file exists it is
  1086.           truncated to zero length. Otherwise a new file is created.
  1087.  
  1088.     `a'
  1089.           Open the file for appending to, i.e. writing to the end of
  1090.           the file. If the file doesn't exist it is created.
  1091.  
  1092.      Other options exist; consult a C library manual for details.
  1093.  
  1094.      When the FILE-OBJECT argument is defined it should be a file
  1095.      object, the file it points to will be closed and the new file will
  1096.      be opened on this object.
  1097.  
  1098. 
  1099. File: jade.info,  Node: Destroying File Objects,  Next: File Object Predicates,  Prev: Creating File Objects,  Up: File Objects
  1100.  
  1101. Destroying File Objects
  1102. .......................
  1103.  
  1104.    The easiest way to close a file is simply to eliminate all
  1105. references to it, subsequently the garbage collector will close it for
  1106. you. It is better to close files explicitly though since only a limited
  1107. number of files may be opened concurrently.
  1108.  
  1109.  - Function: close FILE-OBJECT
  1110.      This function closes the file pointed to by the file object
  1111.      FILE-OBJECT.
  1112.  
  1113.      Until a new file is opened on FILE-OBJECT any read/write accesses
  1114.      to it are illegal and an error will be signalled.
  1115.  
  1116. 
  1117. File: jade.info,  Node: File Object Predicates,  Next: Functions on File Objects,  Prev: Destroying File Objects,  Up: File Objects
  1118.  
  1119. File Object Predicates
  1120. ......................
  1121.  
  1122.  - Function: filep OBJECT
  1123.      This function returns `t' when its argument is a file object.
  1124.  
  1125.  - Function: file-bound-p FILE-OBJECT
  1126.      Returns `t' when the file object FILE-OBJECT is currently bound to
  1127.      a physical file (i.e. the `close' function hasn't been called on
  1128.      it yet).
  1129.  
  1130.  - Function: file-eof-p FILE-OBJECT
  1131.      This function returns `t' when the current position of the file
  1132.      object FILE-OBJECT is the end of the file (i.e. when reading a
  1133.      character from the file would return `nil').
  1134.  
  1135. 
  1136. File: jade.info,  Node: Functions on File Objects,  Prev: File Object Predicates,  Up: File Objects
  1137.  
  1138. Functions on File Objects
  1139. .........................
  1140.  
  1141.  - Function: flush-file FILE-OBJECT
  1142.      This function flushes any buffered output to the file object
  1143.      FILE-OBJECT to disk.
  1144.  
  1145.      Note that when using a file which was opened with the `+' option
  1146.      it's necessary to call this function when switching from reading to
  1147.      writing or vice versa.
  1148.  
  1149.  - Function: file-binding FILE-OBJECT
  1150.      Returns the name of the file which the file object FILE-OBJECT is
  1151.      currently bound to.
  1152.  
  1153.  - Function: read-file-until FILE-OBJECT REGEXP &optional IGNORE-CASE
  1154.      This function reads lines from the file object FILE-OBJECT until a
  1155.      line matching the regular expression REGEXP is found. The matching
  1156.      line is returned, or `nil' if the end of the file is reached.
  1157.  
  1158.      When the IGNORE-CASE option is non-`nil' all regexp matching is
  1159.      done case-insignificantly (except for matching ranges).
  1160.  
  1161. 
  1162. File: jade.info,  Node: File Information,  Next: Manipulating Files,  Prev: File Objects,  Up: Files
  1163.  
  1164. File Information
  1165. ----------------
  1166.  
  1167.    A number of functions exist which when given the name of a file
  1168. return some information about that file.
  1169.  
  1170.  - Function: file-exists-p FILE-NAME
  1171.      Returns `t' when a file FILE-NAME exists.
  1172.  
  1173.  - Function: file-regular-p FILE-NAME
  1174.      Returns `t' when the file FILE-NAME is a `normal' file. This means
  1175.      that it isn't a directory, device, symbolic link or whatever.
  1176.  
  1177.  - Function: file-directory-p FILE-NAME
  1178.      Returns `t' when the file FILE-NAME is a directory.
  1179.  
  1180.  - Function: file-symlink-p FILE-NAME
  1181.      Returns `t' when the file FILE-NAME is a symbolic link.
  1182.  
  1183.  - Function: file-readable-p FILE-NAME
  1184.      Returns `t' when the file FILE-NAME is readable.
  1185.  
  1186.  - Function: file-writable-p FILE-NAME
  1187.      Returns `t' when the file FILE-NAME is writable.
  1188.  
  1189.  - Function: file-owner-p FILE-NAME
  1190.      Returns `t' when the ownership of the file FILE-NAME is the same
  1191.      as that of any files written by the editor.
  1192.  
  1193.      Note that currently this always returns `t' in the Amiga version.
  1194.  
  1195.  - Function: file-nlinks FILE-NAME
  1196.      Returns the number of hard links pointing to the file FILE-NAME. If
  1197.      FILE-NAME has only one name the number will be one.
  1198.  
  1199.      Note that this always returns one in the Amiga version of Jade.
  1200.  
  1201.  - Function: file-modes FILE-NAME
  1202.      This function returns the access permissions of the file FILE-NAME.
  1203.      This will be an integer whose format is undefined; it differs from
  1204.      operating system to operating system.
  1205.  
  1206.  - Function: set-file-modes FILE-NAME MODES
  1207.      This function sets the access permissions of the file FILE-NAME to
  1208.      the integer MODES (as returned by the `file-modes' function).
  1209.  
  1210.  - Function: file-modtime FILE-NAME
  1211.      Returns the system time at the last modification to the file
  1212.      FILE-NAME, this will be an integer. *Note System Time::.
  1213.  
  1214.  - Function: file-newer-than-file-p FILE-NAME1 FILE-NAME2
  1215.      This function returns `t' if the file FILE-NAME1 was modified more
  1216.      recently than the file FILE-NAME2 was.
  1217.  
  1218.           (file-newer-than-file-p FILE1 FILE2)
  1219.           ==
  1220.           (> (file-modtime FILE1) (file-modtime FILE2))
  1221.  
  1222. 
  1223. File: jade.info,  Node: Manipulating Files,  Next: Reading Directories,  Prev: File Information,  Up: Files
  1224.  
  1225. Manipulating Files
  1226. ------------------
  1227.  
  1228.  - Command: delete-file FILE-NAME
  1229.      This function deletes the file called FILE-NAME. When called
  1230.      interactively FILE-NAME is prompted for.
  1231.  
  1232.  - Command: rename-file FILE-NAME NEW-NAME
  1233.      This function attempts to change the name of the file NEW-NAME to
  1234.      NEW-NAME.
  1235.  
  1236.      This won't work from one file system to another or if a file called
  1237.      NEW-NAME already exists, in these cases an error is signalled.
  1238.  
  1239.      This prompts for its arguments when called interactively.
  1240.  
  1241.  - Command: copy-file FILE-NAME DESTINATION-NAME
  1242.      Creates a new copy of the file FILE-NAME with the name
  1243.      DESTINATION-NAME.
  1244.  
  1245.      The access modes of the new file will be the same as those of the
  1246.      original file.
  1247.  
  1248.      The arguments are prompted for when this function is called
  1249.      interactively.
  1250.  
  1251. 
  1252. File: jade.info,  Node: Reading Directories,  Next: Reading and Writing Files,  Prev: Manipulating Files,  Up: Files
  1253.  
  1254. Reading Directories
  1255. -------------------
  1256.  
  1257.  - Function: directory-files DIRECTORY-NAME
  1258.      This function returns a list of the names of all files in the
  1259.      directory whose file name is DIRECTORY-NAME. The names in the list
  1260.      will be relative to the directory DIRECTORY-NAME, any directories
  1261.      in the list will have a `/' character appended to them.
  1262.  
  1263.           (directory-files "/tmp/foo"
  1264.               => ("bar" "subdir/" "xyz" "." "..")
  1265.  
  1266. 
  1267. File: jade.info,  Node: Reading and Writing Files,  Prev: Reading Directories,  Up: Files
  1268.  
  1269. Reading and Writing Files
  1270. -------------------------
  1271.  
  1272.  - Function: read-file FILE-NAME
  1273.      This function returns a string containing the contents of the file
  1274.      called FILE-NAME.
  1275.  
  1276.  - Function: write-file FILE-NAME CONTENTS
  1277.      This function creates or overwrites the file called FILE-NAME with
  1278.      the string CONTENTS as its contents.
  1279.  
  1280. 
  1281. File: jade.info,  Node: Processes,  Next: Miscellaneous Functions,  Prev: Files,  Up: Programming Jade
  1282.  
  1283. Processes
  1284. =========
  1285.  
  1286.    When running on a Unix-style operating system (i.e. the X11 version)
  1287. Jade allows you to launch and control an arbitrary number of
  1288. subprocesses. These subprocesses can run either synchronously or
  1289. asynchronously in respect to the editor; data can be sent to the stdin
  1290. channel and any output from the process is automatically written to a
  1291. programmer-defined Lisp stream.
  1292.  
  1293.    Currently there is *no* way to manipulate subprocesses in the Amiga
  1294. version of Jade (sorry!).
  1295.  
  1296. * Menu:
  1297.  
  1298. * Process Objects::             Lisp objects associated with subprocesses
  1299. * Asynchronous Processes::      Subprocesses running in parallel with Jade
  1300. * Synchronous Processes::       Subprocesses which Jade runs serially
  1301. * Process I/O::                 Input and output with subprocesses
  1302. * Process States::              Suspending subprocesses
  1303. * Signalling Processes::        Sending signals to subprocesses
  1304. * Process Information::         Information stored in a process object
  1305. * Interactive Processes::       Shell mode lets the user interact with a
  1306.                                   subprocess
  1307.  
  1308.