aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorRichard M. Stallman1994-04-23 04:55:38 +0000
committerRichard M. Stallman1994-04-23 04:55:38 +0000
commita65970a0f88f6dd6dfd1863511f8816c22344e24 (patch)
tree44073a42a8ce880282a486a45bb4fa8d57697181 /src
parent5e65b9ab235b54c005ba058fc800dcdc5bd8cc68 (diff)
downloademacs-a65970a0f88f6dd6dfd1863511f8816c22344e24.tar.gz
emacs-a65970a0f88f6dd6dfd1863511f8816c22344e24.zip
(syms_of_fileio): New Lisp var inhibit-file-name-operation.
(Ffind_file_name_handler): Obey that variable. Use new meaning for inhibit-file-name-handlers.
Diffstat (limited to 'src')
-rw-r--r--src/fileio.c47
1 files changed, 30 insertions, 17 deletions
diff --git a/src/fileio.c b/src/fileio.c
index 10f851f16ce..6e2a095f161 100644
--- a/src/fileio.c
+++ b/src/fileio.c
@@ -129,7 +129,15 @@ int insert_default_directory;
129 Zero means use var format. */ 129 Zero means use var format. */
130int vms_stmlf_recfm; 130int vms_stmlf_recfm;
131 131
132/* These variables describe handlers that have "already" had a chance
133 to handle the current operation.
134
135 Vinhibit_file_name_handlers is a list of file name handlers.
136 Vinhibit_file_name_operation is the operation being handled.
137 If we try to handle that operation, we ignore those handlers. */
138
132static Lisp_Object Vinhibit_file_name_handlers; 139static Lisp_Object Vinhibit_file_name_handlers;
140static Lisp_Object Vinhibit_file_name_operation;
133 141
134Lisp_Object Qfile_error, Qfile_already_exists; 142Lisp_Object Qfile_error, Qfile_already_exists;
135 143
@@ -203,29 +211,22 @@ DEFUN ("find-file-name-handler", Ffind_file_name_handler, Sfind_file_name_handle
203Otherwise, return nil.\n\ 211Otherwise, return nil.\n\
204A file name is handled if one of the regular expressions in\n\ 212A file name is handled if one of the regular expressions in\n\
205`file-name-handler-alist' matches it.\n\n\ 213`file-name-handler-alist' matches it.\n\n\
206If FILENAME is a member of `inhibit-file-name-handlers',\n\ 214If OPERATION equals `inhibit-file-name-operation', then we ignore\n\
207then its handler is not run. This lets handlers\n\ 215any handlers that are members of `inhibit-file-name-handlers',\n\
216but we still do run any other handlers. This lets handlers\n\
208use the standard functions without calling themselves recursively.") 217use the standard functions without calling themselves recursively.")
209 (filename, operation) 218 (filename, operation)
210 Lisp_Object filename, operation; 219 Lisp_Object filename, operation;
211{ 220{
212 /* This function must not munge the match data. */ 221 /* This function must not munge the match data. */
213 Lisp_Object chain; 222 Lisp_Object chain, inhibited_handlers;
214 223
215 CHECK_STRING (filename, 0); 224 CHECK_STRING (filename, 0);
216 225
217 if (! NILP (Vinhibit_file_name_handlers)) 226 if (EQ (operation, Vinhibit_file_name_operation))
218 { 227 inhibited_handlers = Vinhibit_file_name_handlers;
219 Lisp_Object tail; 228 else
220 for (tail = Vinhibit_file_name_handlers; CONSP (tail); 229 inhibited_handlers = Qnil;
221 tail = XCONS (tail)->cdr)
222 {
223 Lisp_Object tem;
224 tem = Fstring_equal (tail, filename);
225 if (!NILP (tem))
226 return Qnil;
227 }
228 }
229 230
230 for (chain = Vfile_name_handler_alist; XTYPE (chain) == Lisp_Cons; 231 for (chain = Vfile_name_handler_alist; XTYPE (chain) == Lisp_Cons;
231 chain = XCONS (chain)->cdr) 232 chain = XCONS (chain)->cdr)
@@ -238,7 +239,14 @@ use the standard functions without calling themselves recursively.")
238 string = XCONS (elt)->car; 239 string = XCONS (elt)->car;
239 if (XTYPE (string) == Lisp_String 240 if (XTYPE (string) == Lisp_String
240 && fast_string_match (string, filename) >= 0) 241 && fast_string_match (string, filename) >= 0)
241 return XCONS (elt)->cdr; 242 {
243 Lisp_Object handler, tem;
244
245 handler = XCONS (elt)->cdr;
246 tem = Fmemq (handler, inhibited_handlers);
247 if (NILP (tem))
248 return handler;
249 }
242 } 250 }
243 251
244 QUIT; 252 QUIT;
@@ -3992,9 +4000,14 @@ lists are merged destructively.");
3992 Vwrite_region_annotate_functions = Qnil; 4000 Vwrite_region_annotate_functions = Qnil;
3993 4001
3994 DEFVAR_LISP ("inhibit-file-name-handlers", &Vinhibit_file_name_handlers, 4002 DEFVAR_LISP ("inhibit-file-name-handlers", &Vinhibit_file_name_handlers,
3995 "A list of file names for which handlers should not be used."); 4003 "A list of file names for which handlers should not be used.\n\
4004This applies only to the operation `inhibit-file-name-handlers'.");
3996 Vinhibit_file_name_handlers = Qnil; 4005 Vinhibit_file_name_handlers = Qnil;
3997 4006
4007 DEFVAR_LISP ("inhibit-file-name-operation", &Vinhibit_file_name_operation,
4008 "The operation for which `inhibit-file-name-handlers' is applicable.");
4009 Vinhibit_file_name_operation = Qnil;
4010
3998 defsubr (&Sfind_file_name_handler); 4011 defsubr (&Sfind_file_name_handler);
3999 defsubr (&Sfile_name_directory); 4012 defsubr (&Sfile_name_directory);
4000 defsubr (&Sfile_name_nondirectory); 4013 defsubr (&Sfile_name_nondirectory);