diff options
| author | Po Lu | 2023-08-06 21:45:44 +0800 |
|---|---|---|
| committer | Po Lu | 2023-08-06 21:45:44 +0800 |
| commit | 7ffc5f86e4636f9837a46ea75bee7475caaf5c04 (patch) | |
| tree | 4820056bc76fb582d865b04cc811bafe44d63100 /src | |
| parent | 7873369338ee0159ca285153fd4592cbcff65d7a (diff) | |
| parent | 10a7615b5d45bcd909bb03d67423b337dfe93b1e (diff) | |
| download | emacs-7ffc5f86e4636f9837a46ea75bee7475caaf5c04.tar.gz emacs-7ffc5f86e4636f9837a46ea75bee7475caaf5c04.zip | |
Merge remote-tracking branch 'origin/master' into feature/android
Diffstat (limited to 'src')
| -rw-r--r-- | src/fileio.c | 40 |
1 files changed, 9 insertions, 31 deletions
diff --git a/src/fileio.c b/src/fileio.c index b37748b8225..b815a1bdd79 100644 --- a/src/fileio.c +++ b/src/fileio.c | |||
| @@ -2565,38 +2565,13 @@ DEFUN ("delete-directory-internal", Fdelete_directory_internal, | |||
| 2565 | return Qnil; | 2565 | return Qnil; |
| 2566 | } | 2566 | } |
| 2567 | 2567 | ||
| 2568 | DEFUN ("delete-file", Fdelete_file, Sdelete_file, 1, 2, | 2568 | DEFUN ("delete-file-internal", Fdelete_file_internal, Sdelete_file_internal, 1, 1, 0, |
| 2569 | "(list (read-file-name \ | ||
| 2570 | (if (and delete-by-moving-to-trash (null current-prefix-arg)) \ | ||
| 2571 | \"Move file to trash: \" \"Delete file: \") \ | ||
| 2572 | nil default-directory (confirm-nonexistent-file-or-buffer)) \ | ||
| 2573 | (null current-prefix-arg))", | ||
| 2574 | doc: /* Delete file named FILENAME. If it is a symlink, remove the symlink. | 2569 | doc: /* Delete file named FILENAME. If it is a symlink, remove the symlink. |
| 2575 | If file has multiple names, it continues to exist with the other names. | 2570 | If file has multiple names, it continues to exist with the other names. */) |
| 2576 | TRASH non-nil means to trash the file instead of deleting, provided | 2571 | (Lisp_Object filename) |
| 2577 | `delete-by-moving-to-trash' is non-nil. | ||
| 2578 | |||
| 2579 | When called interactively, TRASH is t if no prefix argument is given. | ||
| 2580 | With a prefix argument, TRASH is nil. */) | ||
| 2581 | (Lisp_Object filename, Lisp_Object trash) | ||
| 2582 | { | 2572 | { |
| 2583 | Lisp_Object handler; | ||
| 2584 | Lisp_Object encoded_file; | 2573 | Lisp_Object encoded_file; |
| 2585 | 2574 | ||
| 2586 | if (!NILP (Ffile_directory_p (filename)) | ||
| 2587 | && NILP (Ffile_symlink_p (filename))) | ||
| 2588 | xsignal2 (Qfile_error, | ||
| 2589 | build_string ("Removing old name: is a directory"), | ||
| 2590 | filename); | ||
| 2591 | filename = Fexpand_file_name (filename, Qnil); | ||
| 2592 | |||
| 2593 | handler = Ffind_file_name_handler (filename, Qdelete_file); | ||
| 2594 | if (!NILP (handler)) | ||
| 2595 | return call3 (handler, Qdelete_file, filename, trash); | ||
| 2596 | |||
| 2597 | if (delete_by_moving_to_trash && !NILP (trash)) | ||
| 2598 | return call1 (Qmove_file_to_trash, filename); | ||
| 2599 | |||
| 2600 | encoded_file = ENCODE_FILE (filename); | 2575 | encoded_file = ENCODE_FILE (filename); |
| 2601 | 2576 | ||
| 2602 | if (emacs_unlink (SSDATA (encoded_file)) != 0 | 2577 | if (emacs_unlink (SSDATA (encoded_file)) != 0 |
| @@ -2832,7 +2807,7 @@ This is what happens in interactive use with M-x. */) | |||
| 2832 | if (dirp) | 2807 | if (dirp) |
| 2833 | call2 (Qdelete_directory, file, Qt); | 2808 | call2 (Qdelete_directory, file, Qt); |
| 2834 | else | 2809 | else |
| 2835 | Fdelete_file (file, Qnil); | 2810 | call2 (Qdelete_file, file, Qnil); |
| 2836 | return unbind_to (count, Qnil); | 2811 | return unbind_to (count, Qnil); |
| 2837 | } | 2812 | } |
| 2838 | 2813 | ||
| @@ -6493,7 +6468,7 @@ syms_of_fileio (void) | |||
| 6493 | DEFSYM (Qcopy_file, "copy-file"); | 6468 | DEFSYM (Qcopy_file, "copy-file"); |
| 6494 | DEFSYM (Qmake_directory_internal, "make-directory-internal"); | 6469 | DEFSYM (Qmake_directory_internal, "make-directory-internal"); |
| 6495 | DEFSYM (Qmake_directory, "make-directory"); | 6470 | DEFSYM (Qmake_directory, "make-directory"); |
| 6496 | DEFSYM (Qdelete_file, "delete-file"); | 6471 | DEFSYM (Qdelete_file_internal, "delete-file-internal"); |
| 6497 | DEFSYM (Qfile_name_case_insensitive_p, "file-name-case-insensitive-p"); | 6472 | DEFSYM (Qfile_name_case_insensitive_p, "file-name-case-insensitive-p"); |
| 6498 | DEFSYM (Qrename_file, "rename-file"); | 6473 | DEFSYM (Qrename_file, "rename-file"); |
| 6499 | DEFSYM (Qadd_name_to_file, "add-name-to-file"); | 6474 | DEFSYM (Qadd_name_to_file, "add-name-to-file"); |
| @@ -6757,6 +6732,9 @@ This includes interactive calls to `delete-file' and | |||
| 6757 | delete_by_moving_to_trash = 0; | 6732 | delete_by_moving_to_trash = 0; |
| 6758 | DEFSYM (Qdelete_by_moving_to_trash, "delete-by-moving-to-trash"); | 6733 | DEFSYM (Qdelete_by_moving_to_trash, "delete-by-moving-to-trash"); |
| 6759 | 6734 | ||
| 6735 | /* Lisp function for interactive file delete with trashing */ | ||
| 6736 | DEFSYM (Qdelete_file, "delete-file"); | ||
| 6737 | |||
| 6760 | /* Lisp function for moving files to trash. */ | 6738 | /* Lisp function for moving files to trash. */ |
| 6761 | DEFSYM (Qmove_file_to_trash, "move-file-to-trash"); | 6739 | DEFSYM (Qmove_file_to_trash, "move-file-to-trash"); |
| 6762 | 6740 | ||
| @@ -6788,7 +6766,7 @@ This includes interactive calls to `delete-file' and | |||
| 6788 | defsubr (&Scopy_file); | 6766 | defsubr (&Scopy_file); |
| 6789 | defsubr (&Smake_directory_internal); | 6767 | defsubr (&Smake_directory_internal); |
| 6790 | defsubr (&Sdelete_directory_internal); | 6768 | defsubr (&Sdelete_directory_internal); |
| 6791 | defsubr (&Sdelete_file); | 6769 | defsubr (&Sdelete_file_internal); |
| 6792 | defsubr (&Sfile_name_case_insensitive_p); | 6770 | defsubr (&Sfile_name_case_insensitive_p); |
| 6793 | defsubr (&Srename_file); | 6771 | defsubr (&Srename_file); |
| 6794 | defsubr (&Sadd_name_to_file); | 6772 | defsubr (&Sadd_name_to_file); |