Changes between Version 2 and Version 3 of HemlockProgrammer/Files


Ignore:
Timestamp:
01/15/08 18:01:08 (6 years ago)
Author:
gz
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • HemlockProgrammer/Files

    v2 v3  
     1[HemlockProgrammer Back to Table of Contents] 
    12[[PageOutline]] 
    23 
    3 = 13. Files = 
     4= 13. Files =#Files 
    45 
    56This chapter discusses ways to read and write files at various 
     
    89are read. 
    910 
    10 == 13.1. File Options and Type Hooks == 
     11== 13.1. File Options and Type Hooks ==#FileOptionsAndTypeHooks 
    1112 
    1213The user specifies file options with a special syntax on the first 
     
    2728appropriate default major mode. 
    2829 
    29 define-file-option name (buffer value) {declaration}* {form}* [Macro] 
     30`define-file-option` name (buffer value) {declaration}* {form}* [Macro] 
    3031 
    3132This defines a new file option with the string 
     
    3334option value string, and forms are evaluated with these bound. 
    3435 
    35 define-file-type-hook type-list (buffer type) {declaration}* {form}* [Macro] 
     36`define-file-type-hook` type-list (buffer type) {declaration}* {form}* [Macro] 
    3637 
    3738This defines some code that process-file-options(below) executes when 
    3839the file options fail to set a major mode.  This associates each type, 
    39 asimple-string, intype-list with a routine that binds bufferto the 
    40 buffer the file is in andtypeto the type of the pathname. 
     40a string, in type-list with a routine that binds buffer to the 
     41buffer the file is in and type to the type of the pathname. 
    4142 
    42 process-file-options buffer &optional pathname [Function] 
     43`process-file-options` buffer &optional pathname [Function] 
    4344 
    4445This checks for file options in buffer and invokes handlers if there 
     
    4849hook. read-buffer-file calls this. 
    4950 
    50 == 13.2. Pathnames and Buffers == 
     51== 13.2. Pathnames and Buffers ==#PathnamesAndBuffers 
    5152 
    5253There is no good way to uniquely identify buffer names and pathnames. 
     
    5657generating prompting defaults when asking the user for pathnames. 
    5758 
    58 pathname-to-buffer-namepathname [Function] 
     59`pathname-to-buffer-name` pathname [Function] 
    5960 
    60 This function returns a string of the form "file-namestring 
    61 directory-namestring". 
     61This function returns a string of the form "file-namestring directory-namestring". 
    6262 
    63 Pathname Defaults (initial value (pathname "gazonk.del")) [Hemlock Variable] 
    64  
    65 Last Resort Pathname Defaults Function [Hemlock Variable] 
    66  
    67 Last Resort Pathname Defaults(initial value (pathname "gazonk")) [Hemlock Variable] 
     63`Pathname Defaults` (initial value (pathname "gazonk.del")) [Hemlock Variable][[BR]] 
     64`Last Resort Pathname Defaults Function` [Hemlock Variable][[BR]] 
     65`Last Resort Pathname Defaults` (initial value (pathname "gazonk")) [Hemlock Variable][[BR]] 
    6866 
    6967These variables control the computation of default pathnames when 
     
    7169default. See the Hemlock User's Manual for more details. 
    7270 
    73 buffer-default-pathname buffer [Function] 
     71`buffer-default-pathname` buffer [Function] 
    7472 
    7573This returns Buffer Pathname if it is bound.  If it is not bound, and 
     
    7977Defaults Function called on buffer. 
    8078 
    81 == 13.3. File Groups == 
     79== 13.3. File Groups ==#FileGroups 
    8280 
    83 File groups provide a simple way of collecting the files that compose 
    84 a system and naming that collection.  Hemlock supports commands for 
    85 searching, replacing, and compiling groups. 
     81Currently Hemlock doesn't have support for file groups. 
    8682 
    87 *active-file-group* [Variable] 
    88  
    89 This is the list of files that constitute the currently selected file 
    90 group.  If this is nil, then there is no current group. 
    91  
    92 do-active-group {form}* [Macro] 
    93  
    94 Group Find File (initial value nil) [Hemlock Variable] 
    95  
    96 Group Save File Confirm (initial value t) [Hemlock Variable] 
    97  
    98 do-active-group iterates over *active-file-group* executing the forms 
    99 once for each file.  While the forms are executing, the file is in the 
    100 current buffer, and the point is at the beginning.  If there is no 
    101 active group, this signals an editor-error. 
    102  
    103 This reads each file into its own buffer using find-file-buffer. Since 
    104 unwanted buffers may consume large amounts of memory, Group Find 
    105 File controls whether to delete the buffer after executing the forms. 
    106 When the variable is false, this deletes the buffer if it did not 
    107 previously exist; however, regardless of this variable, if the user 
    108 leaves the buffer modified, the buffer persists after the forms have 
    109 completed. Whenever this processes a buffer that already existed, it 
    110 saves the location of the buffer's point before and restores it 
    111 afterwards. 
    112  
    113 After processing a buffer, if it is modified, do-active-group tries to 
    114 save it.  If Group Save File Confirmis non-nil, it asks for 
    115 confirmation. 
    116  
    117 == 13.4. File Reading and Writing == 
     83== 13.4. File Reading and Writing ==#FileReadingAndWriting 
    11884 
    11985Common Lisp pathnames are used by the file primitives.  For probing, 
     
    12187functions are available. 
    12288 
    123 read-file pathname mark [Function] 
     89`read-file` pathname mark [Function] 
    12490 
    125 This inserts the file named bypathnameatmark. 
     91This inserts the file named by pathname at mark. 
    12692 
    127 write-file region pathname &key :keep-backup :access :append [Function] 
    128  
    129 Keep Backup Files(initial valuenil) [Hemlock Variable] 
     93`write-file` region pathname &key :keep-backup :append [Function][[BR]] 
     94`Keep Backup Files` (initial value nil) [Hemlock Variable][[BR]] 
    13095 
    13196This function writes the contents of region to the file named by 
     
    140105This signals an error if both append and keep-backup are supplied as non-nil. 
    141106 
    142 Access is an implementation dependent value that is suitable for 
    143 setting pathname's access or protection bits. 
    144  
    145 write-buffer-file buffer pathname [Function] 
    146  
    147 Write File Hook [Hemlock Variable] 
    148  
    149 Add Newline at EOF on Writing File(initial value:ask-user) [Hemlock Variable] 
     107`write-buffer-file` buffer pathname [Function][[BR]] 
     108`Write File Hook` [Hemlock Variable][[BR]] 
     109`Add Newline at EOF on Writing File` (initial value :ask-user) [Hemlock Variable] 
    150110 
    151111write-buffer-file writes buffer to the file named by pathname 
     
    169129 * It invokes Write File Hook. 
    170130 
    171 Write File Hoo kis a list of functions that take the newly written buffer as an argument. 
     131Write File Hook is a list of functions that take the newly written buffer as an argument. 
    172132 
    173 read-buffer-file pathname buffer [Function] 
    174  
    175 Read File Hook [Hemlock Variable] 
     133`read-buffer-file` pathname buffer [Function][[BR]] 
     134`Read File Hook` [Hemlock Variable][[BR]] 
    176135 
    177136read-buffer-file deletes buffer's region and uses read-file to read 
     
    182141   buffer's write date to nil. 
    183142 
    184  * It movesbuffer's point to the beginning. 
     143 * It moves buffer's point to the beginning. 
    185144 
    186  * It setsbuffer's unmodified status. 
     145 * It sets buffer's unmodified status. 
    187146 
    188147 * It sets buffer's pathname to the result of probing pathname if the 
     
    199158buffer read into and whether the file existed, t if so. 
    200159 
    201 find-file-buffer pathname [Function] 
    202160 
    203 This returns a buffer assoicated with the pathname, reading the file 
    204 into a new buffer if necessary.  This returns a second value 
    205 indicating whether a new buffer was created, t if so.  If the file has 
    206 already been read, this checks to see if the file has been modified on 
    207 disk since it was read, giving the user various recovery options. 
    208 This is the basis of the Find File command. 
    209  
     161[HemlockProgrammer Back to Table of Contents]