aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard M. Stallman2005-04-30 20:30:03 +0000
committerRichard M. Stallman2005-04-30 20:30:03 +0000
commit62679725a1a478e9e22dd26ac5c48aa50310f07d (patch)
treed032308deeee408dab8e4f2c6b8f7ced30be986e
parent0b1fc48a5cb40a2ce5d6bc10a83e76d06f7161dc (diff)
downloademacs-62679725a1a478e9e22dd26ac5c48aa50310f07d.tar.gz
emacs-62679725a1a478e9e22dd26ac5c48aa50310f07d.zip
(Magic File Names): Document `operations' property.
-rw-r--r--lispref/files.texi23
1 files changed, 16 insertions, 7 deletions
diff --git a/lispref/files.texi b/lispref/files.texi
index 0b6e7a2832d..b39a552e3af 100644
--- a/lispref/files.texi
+++ b/lispref/files.texi
@@ -2441,7 +2441,7 @@ check the given file name against @code{file-name-handler-alist}. If
2441the file name matches @var{regexp}, the primitives handle that file by 2441the file name matches @var{regexp}, the primitives handle that file by
2442calling @var{handler}. 2442calling @var{handler}.
2443 2443
2444The first argument given to @var{handler} is the name of the 2444 The first argument given to @var{handler} is the name of the
2445primitive, as a symbol; the remaining arguments are the arguments that 2445primitive, as a symbol; the remaining arguments are the arguments that
2446were passed to that primitive. (The first of these arguments is most 2446were passed to that primitive. (The first of these arguments is most
2447often the file name itself.) For example, if you do this: 2447often the file name itself.) For example, if you do this:
@@ -2458,7 +2458,7 @@ called like this:
2458(funcall @var{handler} 'file-exists-p @var{filename}) 2458(funcall @var{handler} 'file-exists-p @var{filename})
2459@end example 2459@end example
2460 2460
2461When a function takes two or more arguments that must be file names, 2461 When a function takes two or more arguments that must be file names,
2462it checks each of those names for a handler. For example, if you do 2462it checks each of those names for a handler. For example, if you do
2463this: 2463this:
2464 2464
@@ -2479,7 +2479,7 @@ this:
2479The @var{handler} then needs to figure out whether to handle 2479The @var{handler} then needs to figure out whether to handle
2480@var{filename} or @var{dirname}. 2480@var{filename} or @var{dirname}.
2481 2481
2482If the specified file name matches more than one handler, the one 2482 If the specified file name matches more than one handler, the one
2483whose match starts last in the file name gets precedence. This rule 2483whose match starts last in the file name gets precedence. This rule
2484is chosen so that handlers for jobs such as uncompression are handled 2484is chosen so that handlers for jobs such as uncompression are handled
2485first, before handlers for jobs such as remote file access. 2485first, before handlers for jobs such as remote file access.
@@ -2575,12 +2575,12 @@ Here are the operations that a magic file name handler gets to handle:
2575@end flushleft 2575@end flushleft
2576@end iftex 2576@end iftex
2577 2577
2578Handlers for @code{insert-file-contents} typically need to clear the 2578 Handlers for @code{insert-file-contents} typically need to clear the
2579buffer's modified flag, with @code{(set-buffer-modified-p nil)}, if the 2579buffer's modified flag, with @code{(set-buffer-modified-p nil)}, if the
2580@var{visit} argument is non-@code{nil}. This also has the effect of 2580@var{visit} argument is non-@code{nil}. This also has the effect of
2581unlocking the buffer if it is locked. 2581unlocking the buffer if it is locked.
2582 2582
2583The handler function must handle all of the above operations, and 2583 The handler function must handle all of the above operations, and
2584possibly others to be added in the future. It need not implement all 2584possibly others to be added in the future. It need not implement all
2585these operations itself---when it has nothing special to do for a 2585these operations itself---when it has nothing special to do for a
2586certain operation, it can reinvoke the primitive, to handle the 2586certain operation, it can reinvoke the primitive, to handle the
@@ -2603,7 +2603,7 @@ for an operation it does not recognize. Here's one way to do this:
2603 (apply operation args))))) 2603 (apply operation args)))))
2604@end smallexample 2604@end smallexample
2605 2605
2606When a handler function decides to call the ordinary Emacs primitive for 2606 When a handler function decides to call the ordinary Emacs primitive for
2607the operation at hand, it needs to prevent the primitive from calling 2607the operation at hand, it needs to prevent the primitive from calling
2608the same handler once again, thus leading to an infinite recursion. The 2608the same handler once again, thus leading to an infinite recursion. The
2609example above shows how to do this, with the variables 2609example above shows how to do this, with the variables
@@ -2614,7 +2614,7 @@ multiple handlers, and for operations that have two file names that may
2614each have handlers. 2614each have handlers.
2615 2615
2616@kindex safe-magic (@r{property}) 2616@kindex safe-magic (@r{property})
2617Handlers that don't really do anything special for actual access to the 2617 Handlers that don't really do anything special for actual access to the
2618file---such as the ones that implement completion of host names for 2618file---such as the ones that implement completion of host names for
2619remote file names---should have a non-@code{nil} @code{safe-magic} 2619remote file names---should have a non-@code{nil} @code{safe-magic}
2620property. For instance, Emacs normally ``protects'' directory names 2620property. For instance, Emacs normally ``protects'' directory names
@@ -2623,6 +2623,15 @@ file names, by prefixing them with @samp{/:}. But if the handler that
2623would be used for them has a non-@code{nil} @code{safe-magic} 2623would be used for them has a non-@code{nil} @code{safe-magic}
2624property, the @samp{/:} is not added. 2624property, the @samp{/:} is not added.
2625 2625
2626@kindex operations (@r{property})
2627 A file name handler can have an @code{operations} property to
2628declare which operations it handles in a nontrivial way. If this
2629property has a non-@code{nil} value, it should be a list of
2630operations; then only those operations will call the handler. This
2631avoids inefficiency, but its main purpose is for autoloaded handler
2632functions, so that they won't be loaded except when they have real
2633work to do.
2634
2626@defvar inhibit-file-name-handlers 2635@defvar inhibit-file-name-handlers
2627This variable holds a list of handlers whose use is presently inhibited 2636This variable holds a list of handlers whose use is presently inhibited
2628for a certain operation. 2637for a certain operation.