Mercurial > emacs
comparison lispref/files.texi @ 37582:fdf780ddf0ae
Explain how handler is called, for magic file operations that take
more than one file-name argument.
author | Richard M. Stallman <rms@gnu.org> |
---|---|
date | Sat, 05 May 2001 22:38:58 +0000 |
parents | 7600e7ac0dcd |
children | 5f4f6cf4a868 |
comparison
equal
deleted
inserted
replaced
37581:b363ae16a6b0 | 37582:fdf780ddf0ae |
---|---|
2190 the file name matches @var{regexp}, the primitives handle that file by | 2190 the file name matches @var{regexp}, the primitives handle that file by |
2191 calling @var{handler}. | 2191 calling @var{handler}. |
2192 | 2192 |
2193 The first argument given to @var{handler} is the name of the primitive; | 2193 The first argument given to @var{handler} is the name of the primitive; |
2194 the remaining arguments are the arguments that were passed to that | 2194 the remaining arguments are the arguments that were passed to that |
2195 operation. (The first of these arguments is typically the file name | 2195 primitive. (The first of these arguments is most often the file name |
2196 itself.) For example, if you do this: | 2196 itself.) For example, if you do this: |
2197 | 2197 |
2198 @example | 2198 @example |
2199 (file-exists-p @var{filename}) | 2199 (file-exists-p @var{filename}) |
2200 @end example | 2200 @end example |
2204 called like this: | 2204 called like this: |
2205 | 2205 |
2206 @example | 2206 @example |
2207 (funcall @var{handler} 'file-exists-p @var{filename}) | 2207 (funcall @var{handler} 'file-exists-p @var{filename}) |
2208 @end example | 2208 @end example |
2209 | |
2210 When a function takes two or more arguments that must be file names, | |
2211 it checks each of those names for a handler. For example, if you do | |
2212 this: | |
2213 | |
2214 @example | |
2215 (expand-file-name @var{filename} @var{dirname}) | |
2216 @end example | |
2217 | |
2218 @noindent | |
2219 then it checks for a handler for @var{filename} and then for a handler | |
2220 for @var{dirname}. In either case, the @var{handler} is called like | |
2221 this: | |
2222 | |
2223 @example | |
2224 (funcall @var{handler} 'expand-file-name @var{filename} @var{dirname}) | |
2225 @end example | |
2226 | |
2227 @noindent | |
2228 The @var{handler} then needs to figure out whether to handle | |
2229 @var{filename} or @var{dirname}. | |
2209 | 2230 |
2210 Here are the operations that a magic file name handler gets to handle: | 2231 Here are the operations that a magic file name handler gets to handle: |
2211 | 2232 |
2212 @ifnottex | 2233 @ifnottex |
2213 @noindent | 2234 @noindent |