aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKarl Heuer1994-04-22 23:56:44 +0000
committerKarl Heuer1994-04-22 23:56:44 +0000
commit49307295be79fd842e2780d0475f5af574050ce9 (patch)
tree15eb8dcb5fcabf38cafeb7c8c31292a19426a10b
parenta617e9133c6854861e327f90fe5f096a33abe4f3 (diff)
downloademacs-49307295be79fd842e2780d0475f5af574050ce9.tar.gz
emacs-49307295be79fd842e2780d0475f5af574050ce9.zip
(Ffind_file_name_handler): New argument OPERATION. All callers changed.
-rw-r--r--src/fileio.c76
1 files changed, 39 insertions, 37 deletions
diff --git a/src/fileio.c b/src/fileio.c
index ba509f0ebec..10f851f16ce 100644
--- a/src/fileio.c
+++ b/src/fileio.c
@@ -198,16 +198,16 @@ Lisp_Object Qwrite_region;
198Lisp_Object Qverify_visited_file_modtime; 198Lisp_Object Qverify_visited_file_modtime;
199Lisp_Object Qset_visited_file_modtime; 199Lisp_Object Qset_visited_file_modtime;
200 200
201DEFUN ("find-file-name-handler", Ffind_file_name_handler, Sfind_file_name_handler, 1, 1, 0, 201DEFUN ("find-file-name-handler", Ffind_file_name_handler, Sfind_file_name_handler, 2, 2, 0,
202 "Return FILENAME's handler function, if its syntax is handled specially.\n\ 202 "Return FILENAME's handler function for OPERATION, if it has one.\n\
203Otherwise, return nil.\n\ 203Otherwise, return nil.\n\
204A file name is handled if one of the regular expressions in\n\ 204A file name is handled if one of the regular expressions in\n\
205`file-name-handler-alist' matches it.\n\n\ 205`file-name-handler-alist' matches it.\n\n\
206If FILENAME is a member of `inhibit-file-name-handlers',\n\ 206If FILENAME is a member of `inhibit-file-name-handlers',\n\
207then its handler is not run. This is lets handlers\n\ 207then its handler is not run. This lets handlers\n\
208use the standard functions without calling themselves recursively.") 208use the standard functions without calling themselves recursively.")
209 (filename) 209 (filename, operation)
210 Lisp_Object filename; 210 Lisp_Object filename, operation;
211{ 211{
212 /* This function must not munge the match data. */ 212 /* This function must not munge the match data. */
213 Lisp_Object chain; 213 Lisp_Object chain;
@@ -264,7 +264,7 @@ on VMS, perhaps instead a string ending in `:', `]' or `>'.")
264 264
265 /* If the file name has special constructs in it, 265 /* If the file name has special constructs in it,
266 call the corresponding file handler. */ 266 call the corresponding file handler. */
267 handler = Ffind_file_name_handler (file); 267 handler = Ffind_file_name_handler (file, Qfile_name_directory);
268 if (!NILP (handler)) 268 if (!NILP (handler))
269 return call2 (handler, Qfile_name_directory, file); 269 return call2 (handler, Qfile_name_directory, file);
270 270
@@ -322,7 +322,7 @@ or the entire name if it contains no slash.")
322 322
323 /* If the file name has special constructs in it, 323 /* If the file name has special constructs in it,
324 call the corresponding file handler. */ 324 call the corresponding file handler. */
325 handler = Ffind_file_name_handler (file); 325 handler = Ffind_file_name_handler (file, Qfile_name_nondirectory);
326 if (!NILP (handler)) 326 if (!NILP (handler))
327 return call2 (handler, Qfile_name_nondirectory, file); 327 return call2 (handler, Qfile_name_nondirectory, file);
328 328
@@ -356,7 +356,7 @@ get a current directory to run processes in.")
356 356
357 /* If the file name has special constructs in it, 357 /* If the file name has special constructs in it,
358 call the corresponding file handler. */ 358 call the corresponding file handler. */
359 handler = Ffind_file_name_handler (filename); 359 handler = Ffind_file_name_handler (filename, Qunhandled_file_name_directory);
360 if (!NILP (handler)) 360 if (!NILP (handler))
361 return call2 (handler, Qunhandled_file_name_directory, filename); 361 return call2 (handler, Qunhandled_file_name_directory, filename);
362 362
@@ -462,7 +462,7 @@ On VMS, converts \"[X]FOO.DIR\" to \"[X.FOO]\", etc.")
462 462
463 /* If the file name has special constructs in it, 463 /* If the file name has special constructs in it,
464 call the corresponding file handler. */ 464 call the corresponding file handler. */
465 handler = Ffind_file_name_handler (file); 465 handler = Ffind_file_name_handler (file, Qfile_name_as_directory);
466 if (!NILP (handler)) 466 if (!NILP (handler))
467 return call2 (handler, Qfile_name_as_directory, file); 467 return call2 (handler, Qfile_name_as_directory, file);
468 468
@@ -643,7 +643,7 @@ it returns a file name such as \"[X]Y.DIR.1\".")
643 643
644 /* If the file name has special constructs in it, 644 /* If the file name has special constructs in it,
645 call the corresponding file handler. */ 645 call the corresponding file handler. */
646 handler = Ffind_file_name_handler (directory); 646 handler = Ffind_file_name_handler (directory, Qdirectory_file_name);
647 if (!NILP (handler)) 647 if (!NILP (handler))
648 return call2 (handler, Qdirectory_file_name, directory); 648 return call2 (handler, Qdirectory_file_name, directory);
649 649
@@ -712,7 +712,7 @@ See also the function `substitute-in-file-name'.")
712 712
713 /* If the file name has special constructs in it, 713 /* If the file name has special constructs in it,
714 call the corresponding file handler. */ 714 call the corresponding file handler. */
715 handler = Ffind_file_name_handler (name); 715 handler = Ffind_file_name_handler (name, Qexpand_file_name);
716 if (!NILP (handler)) 716 if (!NILP (handler))
717 return call3 (handler, Qexpand_file_name, name, defalt); 717 return call3 (handler, Qexpand_file_name, name, defalt);
718 718
@@ -1732,10 +1732,10 @@ A prefix arg makes KEEP-TIME non-nil.")
1732 1732
1733 /* If the input file name has special constructs in it, 1733 /* If the input file name has special constructs in it,
1734 call the corresponding file handler. */ 1734 call the corresponding file handler. */
1735 handler = Ffind_file_name_handler (filename); 1735 handler = Ffind_file_name_handler (filename, Qcopy_file);
1736 /* Likewise for output file name. */ 1736 /* Likewise for output file name. */
1737 if (NILP (handler)) 1737 if (NILP (handler))
1738 handler = Ffind_file_name_handler (newname); 1738 handler = Ffind_file_name_handler (newname, Qcopy_file);
1739 if (!NILP (handler)) 1739 if (!NILP (handler))
1740 RETURN_UNGCPRO (call5 (handler, Qcopy_file, filename, newname, 1740 RETURN_UNGCPRO (call5 (handler, Qcopy_file, filename, newname,
1741 ok_if_already_exists, keep_date)); 1741 ok_if_already_exists, keep_date));
@@ -1830,7 +1830,7 @@ DEFUN ("make-directory-internal", Fmake_directory_internal,
1830 CHECK_STRING (dirname, 0); 1830 CHECK_STRING (dirname, 0);
1831 dirname = Fexpand_file_name (dirname, Qnil); 1831 dirname = Fexpand_file_name (dirname, Qnil);
1832 1832
1833 handler = Ffind_file_name_handler (dirname); 1833 handler = Ffind_file_name_handler (dirname, Qmake_directory);
1834 if (!NILP (handler)) 1834 if (!NILP (handler))
1835 return call3 (handler, Qmake_directory, dirname, Qnil); 1835 return call3 (handler, Qmake_directory, dirname, Qnil);
1836 1836
@@ -1854,7 +1854,7 @@ DEFUN ("delete-directory", Fdelete_directory, Sdelete_directory, 1, 1, "FDelete
1854 dirname = Fexpand_file_name (dirname, Qnil); 1854 dirname = Fexpand_file_name (dirname, Qnil);
1855 dir = XSTRING (dirname)->data; 1855 dir = XSTRING (dirname)->data;
1856 1856
1857 handler = Ffind_file_name_handler (dirname); 1857 handler = Ffind_file_name_handler (dirname, Qdelete_directory);
1858 if (!NILP (handler)) 1858 if (!NILP (handler))
1859 return call2 (handler, Qdelete_directory, dirname); 1859 return call2 (handler, Qdelete_directory, dirname);
1860 1860
@@ -1874,7 +1874,7 @@ If file has multiple names, it continues to exist with the other names.")
1874 CHECK_STRING (filename, 0); 1874 CHECK_STRING (filename, 0);
1875 filename = Fexpand_file_name (filename, Qnil); 1875 filename = Fexpand_file_name (filename, Qnil);
1876 1876
1877 handler = Ffind_file_name_handler (filename); 1877 handler = Ffind_file_name_handler (filename, Qdelete_file);
1878 if (!NILP (handler)) 1878 if (!NILP (handler))
1879 return call2 (handler, Qdelete_file, filename); 1879 return call2 (handler, Qdelete_file, filename);
1880 1880
@@ -1908,9 +1908,9 @@ This is what happens in interactive use with M-x.")
1908 1908
1909 /* If the file name has special constructs in it, 1909 /* If the file name has special constructs in it,
1910 call the corresponding file handler. */ 1910 call the corresponding file handler. */
1911 handler = Ffind_file_name_handler (filename); 1911 handler = Ffind_file_name_handler (filename, Qrename_file);
1912 if (NILP (handler)) 1912 if (NILP (handler))
1913 handler = Ffind_file_name_handler (newname); 1913 handler = Ffind_file_name_handler (newname, Qrename_file);
1914 if (!NILP (handler)) 1914 if (!NILP (handler))
1915 RETURN_UNGCPRO (call4 (handler, Qrename_file, 1915 RETURN_UNGCPRO (call4 (handler, Qrename_file,
1916 filename, newname, ok_if_already_exists)); 1916 filename, newname, ok_if_already_exists));
@@ -1973,7 +1973,7 @@ This is what happens in interactive use with M-x.")
1973 1973
1974 /* If the file name has special constructs in it, 1974 /* If the file name has special constructs in it,
1975 call the corresponding file handler. */ 1975 call the corresponding file handler. */
1976 handler = Ffind_file_name_handler (filename); 1976 handler = Ffind_file_name_handler (filename, Qadd_name_to_file);
1977 if (!NILP (handler)) 1977 if (!NILP (handler))
1978 RETURN_UNGCPRO (call4 (handler, Qadd_name_to_file, filename, 1978 RETURN_UNGCPRO (call4 (handler, Qadd_name_to_file, filename,
1979 newname, ok_if_already_exists)); 1979 newname, ok_if_already_exists));
@@ -2027,7 +2027,7 @@ This happens for interactive use with M-x.")
2027 2027
2028 /* If the file name has special constructs in it, 2028 /* If the file name has special constructs in it,
2029 call the corresponding file handler. */ 2029 call the corresponding file handler. */
2030 handler = Ffind_file_name_handler (filename); 2030 handler = Ffind_file_name_handler (filename, Qmake_symbolic_link);
2031 if (!NILP (handler)) 2031 if (!NILP (handler))
2032 RETURN_UNGCPRO (call4 (handler, Qmake_symbolic_link, filename, 2032 RETURN_UNGCPRO (call4 (handler, Qmake_symbolic_link, filename,
2033 linkname, ok_if_already_exists)); 2033 linkname, ok_if_already_exists));
@@ -2148,7 +2148,7 @@ See also `file-readable-p' and `file-attributes'.")
2148 2148
2149 /* If the file name has special constructs in it, 2149 /* If the file name has special constructs in it,
2150 call the corresponding file handler. */ 2150 call the corresponding file handler. */
2151 handler = Ffind_file_name_handler (abspath); 2151 handler = Ffind_file_name_handler (abspath, Qfile_exists_p);
2152 if (!NILP (handler)) 2152 if (!NILP (handler))
2153 return call2 (handler, Qfile_exists_p, abspath); 2153 return call2 (handler, Qfile_exists_p, abspath);
2154 2154
@@ -2170,7 +2170,7 @@ For a directory, this means you can access files in that directory.")
2170 2170
2171 /* If the file name has special constructs in it, 2171 /* If the file name has special constructs in it,
2172 call the corresponding file handler. */ 2172 call the corresponding file handler. */
2173 handler = Ffind_file_name_handler (abspath); 2173 handler = Ffind_file_name_handler (abspath, Qfile_executable_p);
2174 if (!NILP (handler)) 2174 if (!NILP (handler))
2175 return call2 (handler, Qfile_executable_p, abspath); 2175 return call2 (handler, Qfile_executable_p, abspath);
2176 2176
@@ -2191,7 +2191,7 @@ See also `file-exists-p' and `file-attributes'.")
2191 2191
2192 /* If the file name has special constructs in it, 2192 /* If the file name has special constructs in it,
2193 call the corresponding file handler. */ 2193 call the corresponding file handler. */
2194 handler = Ffind_file_name_handler (abspath); 2194 handler = Ffind_file_name_handler (abspath, Qfile_readable_p);
2195 if (!NILP (handler)) 2195 if (!NILP (handler))
2196 return call2 (handler, Qfile_readable_p, abspath); 2196 return call2 (handler, Qfile_readable_p, abspath);
2197 2197
@@ -2217,7 +2217,7 @@ Otherwise returns nil.")
2217 2217
2218 /* If the file name has special constructs in it, 2218 /* If the file name has special constructs in it,
2219 call the corresponding file handler. */ 2219 call the corresponding file handler. */
2220 handler = Ffind_file_name_handler (filename); 2220 handler = Ffind_file_name_handler (filename, Qfile_symlink_p);
2221 if (!NILP (handler)) 2221 if (!NILP (handler))
2222 return call2 (handler, Qfile_symlink_p, filename); 2222 return call2 (handler, Qfile_symlink_p, filename);
2223 2223
@@ -2284,7 +2284,7 @@ DEFUN ("file-writable-p", Ffile_writable_p, Sfile_writable_p, 1, 1, 0,
2284 2284
2285 /* If the file name has special constructs in it, 2285 /* If the file name has special constructs in it,
2286 call the corresponding file handler. */ 2286 call the corresponding file handler. */
2287 handler = Ffind_file_name_handler (abspath); 2287 handler = Ffind_file_name_handler (abspath, Qfile_writable_p);
2288 if (!NILP (handler)) 2288 if (!NILP (handler))
2289 return call2 (handler, Qfile_writable_p, abspath); 2289 return call2 (handler, Qfile_writable_p, abspath);
2290 2290
@@ -2321,7 +2321,7 @@ if the directory so specified exists and really is a directory.")
2321 2321
2322 /* If the file name has special constructs in it, 2322 /* If the file name has special constructs in it,
2323 call the corresponding file handler. */ 2323 call the corresponding file handler. */
2324 handler = Ffind_file_name_handler (abspath); 2324 handler = Ffind_file_name_handler (abspath, Qfile_directory_p);
2325 if (!NILP (handler)) 2325 if (!NILP (handler))
2326 return call2 (handler, Qfile_directory_p, abspath); 2326 return call2 (handler, Qfile_directory_p, abspath);
2327 2327
@@ -2344,7 +2344,7 @@ searchable directory.")
2344 2344
2345 /* If the file name has special constructs in it, 2345 /* If the file name has special constructs in it,
2346 call the corresponding file handler. */ 2346 call the corresponding file handler. */
2347 handler = Ffind_file_name_handler (filename); 2347 handler = Ffind_file_name_handler (filename, Qfile_accessible_directory_p);
2348 if (!NILP (handler)) 2348 if (!NILP (handler))
2349 return call2 (handler, Qfile_accessible_directory_p, filename); 2349 return call2 (handler, Qfile_accessible_directory_p, filename);
2350 2350
@@ -2368,7 +2368,7 @@ DEFUN ("file-modes", Ffile_modes, Sfile_modes, 1, 1, 0,
2368 2368
2369 /* If the file name has special constructs in it, 2369 /* If the file name has special constructs in it,
2370 call the corresponding file handler. */ 2370 call the corresponding file handler. */
2371 handler = Ffind_file_name_handler (abspath); 2371 handler = Ffind_file_name_handler (abspath, Qfile_modes);
2372 if (!NILP (handler)) 2372 if (!NILP (handler))
2373 return call2 (handler, Qfile_modes, abspath); 2373 return call2 (handler, Qfile_modes, abspath);
2374 2374
@@ -2404,7 +2404,7 @@ Only the 12 low bits of MODE are used.")
2404 2404
2405 /* If the file name has special constructs in it, 2405 /* If the file name has special constructs in it,
2406 call the corresponding file handler. */ 2406 call the corresponding file handler. */
2407 handler = Ffind_file_name_handler (abspath); 2407 handler = Ffind_file_name_handler (abspath, Qset_file_modes);
2408 if (!NILP (handler)) 2408 if (!NILP (handler))
2409 return call3 (handler, Qset_file_modes, abspath, mode); 2409 return call3 (handler, Qset_file_modes, abspath, mode);
2410 2410
@@ -2507,9 +2507,9 @@ otherwise, if FILE2 does not exist, the answer is t.")
2507 2507
2508 /* If the file name has special constructs in it, 2508 /* If the file name has special constructs in it,
2509 call the corresponding file handler. */ 2509 call the corresponding file handler. */
2510 handler = Ffind_file_name_handler (abspath1); 2510 handler = Ffind_file_name_handler (abspath1, Qfile_newer_than_file_p);
2511 if (NILP (handler)) 2511 if (NILP (handler))
2512 handler = Ffind_file_name_handler (abspath2); 2512 handler = Ffind_file_name_handler (abspath2, Qfile_newer_than_file_p);
2513 if (!NILP (handler)) 2513 if (!NILP (handler))
2514 return call3 (handler, Qfile_newer_than_file_p, abspath1, abspath2); 2514 return call3 (handler, Qfile_newer_than_file_p, abspath1, abspath2);
2515 2515
@@ -2569,7 +2569,7 @@ and (2) it puts less data in the undo list.")
2569 2569
2570 /* If the file name has special constructs in it, 2570 /* If the file name has special constructs in it,
2571 call the corresponding file handler. */ 2571 call the corresponding file handler. */
2572 handler = Ffind_file_name_handler (filename); 2572 handler = Ffind_file_name_handler (filename, Qinsert_file_contents);
2573 if (!NILP (handler)) 2573 if (!NILP (handler))
2574 { 2574 {
2575 val = call6 (handler, Qinsert_file_contents, filename, 2575 val = call6 (handler, Qinsert_file_contents, filename,
@@ -2943,10 +2943,10 @@ to the file, instead of any buffer contents, and END is ignored.")
2943 2943
2944 /* If the file name has special constructs in it, 2944 /* If the file name has special constructs in it,
2945 call the corresponding file handler. */ 2945 call the corresponding file handler. */
2946 handler = Ffind_file_name_handler (filename); 2946 handler = Ffind_file_name_handler (filename, Qwrite_region);
2947 /* If FILENAME has no handler, see if VISIT has one. */ 2947 /* If FILENAME has no handler, see if VISIT has one. */
2948 if (NILP (handler) && XTYPE (visit) == Lisp_String) 2948 if (NILP (handler) && XTYPE (visit) == Lisp_String)
2949 handler = Ffind_file_name_handler (visit); 2949 handler = Ffind_file_name_handler (visit, Qwrite_region);
2950 2950
2951 if (!NILP (handler)) 2951 if (!NILP (handler))
2952 { 2952 {
@@ -3339,7 +3339,8 @@ This means that the file has not been changed since it was visited or saved.")
3339 3339
3340 /* If the file name has special constructs in it, 3340 /* If the file name has special constructs in it,
3341 call the corresponding file handler. */ 3341 call the corresponding file handler. */
3342 handler = Ffind_file_name_handler (b->filename); 3342 handler = Ffind_file_name_handler (b->filename,
3343 Qverify_visited_file_modtime);
3343 if (!NILP (handler)) 3344 if (!NILP (handler))
3344 return call2 (handler, Qverify_visited_file_modtime, buf); 3345 return call2 (handler, Qverify_visited_file_modtime, buf);
3345 3346
@@ -3404,7 +3405,7 @@ An argument specifies the modification time value to use\n\
3404 3405
3405 /* If the file name has special constructs in it, 3406 /* If the file name has special constructs in it,
3406 call the corresponding file handler. */ 3407 call the corresponding file handler. */
3407 handler = Ffind_file_name_handler (filename); 3408 handler = Ffind_file_name_handler (filename, Qset_visited_file_modtime);
3408 if (!NILP (handler)) 3409 if (!NILP (handler))
3409 /* The handler can find the file name the same way we did. */ 3410 /* The handler can find the file name the same way we did. */
3410 return call2 (handler, Qset_visited_file_modtime, Qnil); 3411 return call2 (handler, Qset_visited_file_modtime, Qnil);
@@ -3511,7 +3512,8 @@ Non-nil second argument means save only current buffer.")
3511 /* -1 means we've turned off autosaving for a while--see below. */ 3512 /* -1 means we've turned off autosaving for a while--see below. */
3512 && XINT (b->save_length) >= 0 3513 && XINT (b->save_length) >= 0
3513 && (do_handled_files 3514 && (do_handled_files
3514 || NILP (Ffind_file_name_handler (b->auto_save_file_name)))) 3515 || NILP (Ffind_file_name_handler (b->auto_save_file_name,
3516 Qwrite_region))))
3515 { 3517 {
3516 EMACS_TIME before_time, after_time; 3518 EMACS_TIME before_time, after_time;
3517 3519