aboutsummaryrefslogtreecommitdiffstats
path: root/src/fileio.c
diff options
context:
space:
mode:
authorStefan Monnier2015-04-13 14:05:09 -0400
committerStefan Monnier2015-04-13 14:05:09 -0400
commit5729f459d1dbb28bc405a142860a99e1329f388a (patch)
treefd47406fdfe5c37382edb1808b0d690ee77f47fa /src/fileio.c
parent5d9432e6491f63fe4859a46737516c9510643626 (diff)
downloademacs-5729f459d1dbb28bc405a142860a99e1329f388a.tar.gz
emacs-5729f459d1dbb28bc405a142860a99e1329f388a.zip
Collapse successive char deletions in the undo log
* src/cmds.c (remove_excessive_undo_boundaries): New function, extracted from Fself_insert_command. (Fdelete_char, Fself_insert_command): Use it. * src/fileio.c (Fmake_symbolic_link): Rename arg to `target'. * src/keyboard.c (syms_of_keyboard): `top-level' shouldn't be special.
Diffstat (limited to 'src/fileio.c')
-rw-r--r--src/fileio.c32
1 files changed, 16 insertions, 16 deletions
diff --git a/src/fileio.c b/src/fileio.c
index a6e7fbb83d2..796f08d3c58 100644
--- a/src/fileio.c
+++ b/src/fileio.c
@@ -2344,62 +2344,62 @@ This is what happens in interactive use with M-x. */)
2344 2344
2345DEFUN ("make-symbolic-link", Fmake_symbolic_link, Smake_symbolic_link, 2, 3, 2345DEFUN ("make-symbolic-link", Fmake_symbolic_link, Smake_symbolic_link, 2, 3,
2346 "FMake symbolic link to file: \nGMake symbolic link to file %s: \np", 2346 "FMake symbolic link to file: \nGMake symbolic link to file %s: \np",
2347 doc: /* Make a symbolic link to FILENAME, named LINKNAME. 2347 doc: /* Make a symbolic link to TARGET, named LINKNAME.
2348Both args must be strings. 2348Both args must be strings.
2349Signals a `file-already-exists' error if a file LINKNAME already exists 2349Signals a `file-already-exists' error if a file LINKNAME already exists
2350unless optional third argument OK-IF-ALREADY-EXISTS is non-nil. 2350unless optional third argument OK-IF-ALREADY-EXISTS is non-nil.
2351A number as third arg means request confirmation if LINKNAME already exists. 2351A number as third arg means request confirmation if LINKNAME already exists.
2352This happens for interactive use with M-x. */) 2352This happens for interactive use with M-x. */)
2353 (Lisp_Object filename, Lisp_Object linkname, Lisp_Object ok_if_already_exists) 2353 (Lisp_Object target, Lisp_Object linkname, Lisp_Object ok_if_already_exists)
2354{ 2354{
2355 Lisp_Object handler; 2355 Lisp_Object handler;
2356 Lisp_Object encoded_filename, encoded_linkname; 2356 Lisp_Object encoded_target, encoded_linkname;
2357 struct gcpro gcpro1, gcpro2, gcpro3, gcpro4; 2357 struct gcpro gcpro1, gcpro2, gcpro3, gcpro4;
2358 2358
2359 GCPRO4 (filename, linkname, encoded_filename, encoded_linkname); 2359 GCPRO4 (target, linkname, encoded_target, encoded_linkname);
2360 encoded_filename = encoded_linkname = Qnil; 2360 encoded_target = encoded_linkname = Qnil;
2361 CHECK_STRING (filename); 2361 CHECK_STRING (target);
2362 CHECK_STRING (linkname); 2362 CHECK_STRING (linkname);
2363 /* If the link target has a ~, we must expand it to get 2363 /* If the link target has a ~, we must expand it to get
2364 a truly valid file name. Otherwise, do not expand; 2364 a truly valid file name. Otherwise, do not expand;
2365 we want to permit links to relative file names. */ 2365 we want to permit links to relative file names. */
2366 if (SREF (filename, 0) == '~') 2366 if (SREF (target, 0) == '~')
2367 filename = Fexpand_file_name (filename, Qnil); 2367 target = Fexpand_file_name (target, Qnil);
2368 2368
2369 if (!NILP (Ffile_directory_p (linkname))) 2369 if (!NILP (Ffile_directory_p (linkname)))
2370 linkname = Fexpand_file_name (Ffile_name_nondirectory (filename), linkname); 2370 linkname = Fexpand_file_name (Ffile_name_nondirectory (target), linkname);
2371 else 2371 else
2372 linkname = Fexpand_file_name (linkname, Qnil); 2372 linkname = Fexpand_file_name (linkname, Qnil);
2373 2373
2374 /* If the file name has special constructs in it, 2374 /* If the file name has special constructs in it,
2375 call the corresponding file handler. */ 2375 call the corresponding file handler. */
2376 handler = Ffind_file_name_handler (filename, Qmake_symbolic_link); 2376 handler = Ffind_file_name_handler (target, Qmake_symbolic_link);
2377 if (!NILP (handler)) 2377 if (!NILP (handler))
2378 RETURN_UNGCPRO (call4 (handler, Qmake_symbolic_link, filename, 2378 RETURN_UNGCPRO (call4 (handler, Qmake_symbolic_link, target,
2379 linkname, ok_if_already_exists)); 2379 linkname, ok_if_already_exists));
2380 2380
2381 /* If the new link name has special constructs in it, 2381 /* If the new link name has special constructs in it,
2382 call the corresponding file handler. */ 2382 call the corresponding file handler. */
2383 handler = Ffind_file_name_handler (linkname, Qmake_symbolic_link); 2383 handler = Ffind_file_name_handler (linkname, Qmake_symbolic_link);
2384 if (!NILP (handler)) 2384 if (!NILP (handler))
2385 RETURN_UNGCPRO (call4 (handler, Qmake_symbolic_link, filename, 2385 RETURN_UNGCPRO (call4 (handler, Qmake_symbolic_link, target,
2386 linkname, ok_if_already_exists)); 2386 linkname, ok_if_already_exists));
2387 2387
2388 encoded_filename = ENCODE_FILE (filename); 2388 encoded_target = ENCODE_FILE (target);
2389 encoded_linkname = ENCODE_FILE (linkname); 2389 encoded_linkname = ENCODE_FILE (linkname);
2390 2390
2391 if (NILP (ok_if_already_exists) 2391 if (NILP (ok_if_already_exists)
2392 || INTEGERP (ok_if_already_exists)) 2392 || INTEGERP (ok_if_already_exists))
2393 barf_or_query_if_file_exists (linkname, false, "make it a link", 2393 barf_or_query_if_file_exists (linkname, false, "make it a link",
2394 INTEGERP (ok_if_already_exists), false); 2394 INTEGERP (ok_if_already_exists), false);
2395 if (symlink (SSDATA (encoded_filename), SSDATA (encoded_linkname)) < 0) 2395 if (symlink (SSDATA (encoded_target), SSDATA (encoded_linkname)) < 0)
2396 { 2396 {
2397 /* If we didn't complain already, silently delete existing file. */ 2397 /* If we didn't complain already, silently delete existing file. */
2398 int symlink_errno; 2398 int symlink_errno;
2399 if (errno == EEXIST) 2399 if (errno == EEXIST)
2400 { 2400 {
2401 unlink (SSDATA (encoded_linkname)); 2401 unlink (SSDATA (encoded_linkname));
2402 if (symlink (SSDATA (encoded_filename), SSDATA (encoded_linkname)) 2402 if (symlink (SSDATA (encoded_target), SSDATA (encoded_linkname))
2403 >= 0) 2403 >= 0)
2404 { 2404 {
2405 UNGCPRO; 2405 UNGCPRO;
@@ -2414,7 +2414,7 @@ This happens for interactive use with M-x. */)
2414 } 2414 }
2415 2415
2416 symlink_errno = errno; 2416 symlink_errno = errno;
2417 report_file_errno ("Making symbolic link", list2 (filename, linkname), 2417 report_file_errno ("Making symbolic link", list2 (target, linkname),
2418 symlink_errno); 2418 symlink_errno);
2419 } 2419 }
2420 UNGCPRO; 2420 UNGCPRO;