diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/ChangeLog | 13 | ||||
| -rw-r--r-- | src/buffer.c | 2 | ||||
| -rw-r--r-- | src/callproc.c | 2 | ||||
| -rw-r--r-- | src/fileio.c | 41 | ||||
| -rw-r--r-- | src/lisp.h | 2 |
5 files changed, 36 insertions, 24 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index 883d603bf35..8c9e1568008 100644 --- a/src/ChangeLog +++ b/src/ChangeLog | |||
| @@ -1,5 +1,18 @@ | |||
| 1 | 2010-05-27 Chong Yidong <cyd@stupidchicken.com> | 1 | 2010-05-27 Chong Yidong <cyd@stupidchicken.com> |
| 2 | 2 | ||
| 3 | * fileio.c (Fdelete_file): Change meaning of optional arg to mean | ||
| 4 | whether to trash. | ||
| 5 | (internal_delete_file, Frename_file): Callers changed. | ||
| 6 | (delete_by_moving_to_trash): Doc fix. | ||
| 7 | (Fdelete_directory_internal): Don't move to trash. | ||
| 8 | |||
| 9 | * callproc.c (delete_temp_file): | ||
| 10 | * buffer.c (Fkill_buffer): Callers changed. | ||
| 11 | |||
| 12 | * lisp.h: Update prototype. | ||
| 13 | |||
| 14 | 2010-05-27 Chong Yidong <cyd@stupidchicken.com> | ||
| 15 | |||
| 3 | * xdisp.c (redisplay_window): After redisplay, check if point is | 16 | * xdisp.c (redisplay_window): After redisplay, check if point is |
| 4 | still valid before setting it (Bug#6177). | 17 | still valid before setting it (Bug#6177). |
| 5 | 18 | ||
diff --git a/src/buffer.c b/src/buffer.c index 339bc99dcb1..b19286c6ea9 100644 --- a/src/buffer.c +++ b/src/buffer.c | |||
| @@ -1547,7 +1547,7 @@ with SIGHUP. */) | |||
| 1547 | Lisp_Object tem; | 1547 | Lisp_Object tem; |
| 1548 | tem = Fsymbol_value (intern ("delete-auto-save-files")); | 1548 | tem = Fsymbol_value (intern ("delete-auto-save-files")); |
| 1549 | if (! NILP (tem)) | 1549 | if (! NILP (tem)) |
| 1550 | internal_delete_file (b->auto_save_file_name, Qt); | 1550 | internal_delete_file (b->auto_save_file_name); |
| 1551 | } | 1551 | } |
| 1552 | 1552 | ||
| 1553 | if (b->base_buffer) | 1553 | if (b->base_buffer) |
diff --git a/src/callproc.c b/src/callproc.c index 44dd6ed7764..f922433eb42 100644 --- a/src/callproc.c +++ b/src/callproc.c | |||
| @@ -856,7 +856,7 @@ delete_temp_file (name) | |||
| 856 | /* Suppress jka-compr handling, etc. */ | 856 | /* Suppress jka-compr handling, etc. */ |
| 857 | int count = SPECPDL_INDEX (); | 857 | int count = SPECPDL_INDEX (); |
| 858 | specbind (intern ("file-name-handler-alist"), Qnil); | 858 | specbind (intern ("file-name-handler-alist"), Qnil); |
| 859 | internal_delete_file (name, Qt); | 859 | internal_delete_file (name); |
| 860 | unbind_to (count, Qnil); | 860 | unbind_to (count, Qnil); |
| 861 | return Qnil; | 861 | return Qnil; |
| 862 | } | 862 | } |
diff --git a/src/fileio.c b/src/fileio.c index de32bfecd34..d3aea0f1e91 100644 --- a/src/fileio.c +++ b/src/fileio.c | |||
| @@ -2180,12 +2180,7 @@ DEFUN ("delete-directory-internal", Fdelete_directory_internal, | |||
| 2180 | 2180 | ||
| 2181 | CHECK_STRING (directory); | 2181 | CHECK_STRING (directory); |
| 2182 | directory = Fdirectory_file_name (Fexpand_file_name (directory, Qnil)); | 2182 | directory = Fdirectory_file_name (Fexpand_file_name (directory, Qnil)); |
| 2183 | |||
| 2184 | if (delete_by_moving_to_trash) | ||
| 2185 | return call1 (Qmove_file_to_trash, directory); | ||
| 2186 | |||
| 2187 | encoded_dir = ENCODE_FILE (directory); | 2183 | encoded_dir = ENCODE_FILE (directory); |
| 2188 | |||
| 2189 | dir = SDATA (encoded_dir); | 2184 | dir = SDATA (encoded_dir); |
| 2190 | 2185 | ||
| 2191 | if (rmdir (dir) != 0) | 2186 | if (rmdir (dir) != 0) |
| @@ -2195,19 +2190,21 @@ DEFUN ("delete-directory-internal", Fdelete_directory_internal, | |||
| 2195 | } | 2190 | } |
| 2196 | 2191 | ||
| 2197 | DEFUN ("delete-file", Fdelete_file, Sdelete_file, 1, 2, | 2192 | DEFUN ("delete-file", Fdelete_file, Sdelete_file, 1, 2, |
| 2198 | "(list (read-file-name \"Delete file: \" nil default-directory \ | 2193 | "(list (read-file-name \ |
| 2199 | (confirm-nonexistent-file-or-buffer)) \ | 2194 | (if (and delete-by-moving-to-trash (null current-prefix-arg)) \ |
| 2200 | current-prefix-arg)", | 2195 | \"Move file to trash: \" \"Delete file: \") \ |
| 2196 | nil default-directory (confirm-nonexistent-file-or-buffer)) \ | ||
| 2197 | (null current-prefix-arg))", | ||
| 2201 | doc: /* Delete file named FILENAME. If it is a symlink, remove the symlink. | 2198 | doc: /* Delete file named FILENAME. If it is a symlink, remove the symlink. |
| 2202 | If file has multiple names, it continues to exist with the other names. | 2199 | If file has multiple names, it continues to exist with the other names. |
| 2200 | TRASH non-nil means to trash the file instead of deleting, provided | ||
| 2201 | `delete-by-moving-to-trash' is non-nil. | ||
| 2203 | 2202 | ||
| 2204 | If optional arg FORCE is non-nil, really delete the file regardless of | 2203 | When called interactively, TRASH is t if no prefix argument is given. |
| 2205 | `delete-by-moving-to-trash'. Otherwise, \"deleting\" actually moves | 2204 | With a prefix argument, TRASH is nil. */) |
| 2206 | it to the system's trash can if `delete-by-moving-to-trash' is non-nil. | 2205 | (filename, trash) |
| 2207 | Interactively, FORCE is non-nil if called with a prefix arg. */) | ||
| 2208 | (filename, force) | ||
| 2209 | Lisp_Object filename; | 2206 | Lisp_Object filename; |
| 2210 | Lisp_Object force; | 2207 | Lisp_Object trash; |
| 2211 | { | 2208 | { |
| 2212 | Lisp_Object handler; | 2209 | Lisp_Object handler; |
| 2213 | Lisp_Object encoded_file; | 2210 | Lisp_Object encoded_file; |
| @@ -2226,7 +2223,7 @@ Interactively, FORCE is non-nil if called with a prefix arg. */) | |||
| 2226 | if (!NILP (handler)) | 2223 | if (!NILP (handler)) |
| 2227 | return call2 (handler, Qdelete_file, filename); | 2224 | return call2 (handler, Qdelete_file, filename); |
| 2228 | 2225 | ||
| 2229 | if (delete_by_moving_to_trash && NILP (force)) | 2226 | if (delete_by_moving_to_trash && !NILP (trash)) |
| 2230 | return call1 (Qmove_file_to_trash, filename); | 2227 | return call1 (Qmove_file_to_trash, filename); |
| 2231 | 2228 | ||
| 2232 | encoded_file = ENCODE_FILE (filename); | 2229 | encoded_file = ENCODE_FILE (filename); |
| @@ -2244,14 +2241,14 @@ internal_delete_file_1 (ignore) | |||
| 2244 | } | 2241 | } |
| 2245 | 2242 | ||
| 2246 | /* Delete file FILENAME, returning 1 if successful and 0 if failed. | 2243 | /* Delete file FILENAME, returning 1 if successful and 0 if failed. |
| 2247 | FORCE means to ignore `delete-by-moving-to-trash'. */ | 2244 | This ignores `delete-by-moving-to-trash'. */ |
| 2248 | 2245 | ||
| 2249 | int | 2246 | int |
| 2250 | internal_delete_file (Lisp_Object filename, Lisp_Object force) | 2247 | internal_delete_file (Lisp_Object filename) |
| 2251 | { | 2248 | { |
| 2252 | Lisp_Object tem; | 2249 | Lisp_Object tem; |
| 2253 | 2250 | ||
| 2254 | tem = internal_condition_case_2 (Fdelete_file, filename, force, | 2251 | tem = internal_condition_case_2 (Fdelete_file, filename, Qnil, |
| 2255 | Qt, internal_delete_file_1); | 2252 | Qt, internal_delete_file_1); |
| 2256 | return NILP (tem); | 2253 | return NILP (tem); |
| 2257 | } | 2254 | } |
| @@ -2345,7 +2342,7 @@ This is what happens in interactive use with M-x. */) | |||
| 2345 | ) | 2342 | ) |
| 2346 | call2 (Qdelete_directory, file, Qt); | 2343 | call2 (Qdelete_directory, file, Qt); |
| 2347 | else | 2344 | else |
| 2348 | Fdelete_file (file, Qt); | 2345 | Fdelete_file (file, Qnil); |
| 2349 | unbind_to (count, Qnil); | 2346 | unbind_to (count, Qnil); |
| 2350 | } | 2347 | } |
| 2351 | else | 2348 | else |
| @@ -5917,8 +5914,10 @@ A non-nil value may result in data loss! */); | |||
| 5917 | 5914 | ||
| 5918 | DEFVAR_BOOL ("delete-by-moving-to-trash", &delete_by_moving_to_trash, | 5915 | DEFVAR_BOOL ("delete-by-moving-to-trash", &delete_by_moving_to_trash, |
| 5919 | doc: /* Specifies whether to use the system's trash can. | 5916 | doc: /* Specifies whether to use the system's trash can. |
| 5920 | When non-nil, the function `move-file-to-trash' will be used by | 5917 | When non-nil, certain file deletion commands use the function |
| 5921 | `delete-file' and `delete-directory'. */); | 5918 | `move-file-to-trash' instead of deleting files outright. |
| 5919 | This includes interactive calls to `delete-file' and | ||
| 5920 | `delete-directory' and the Dired deletion commands. */); | ||
| 5922 | delete_by_moving_to_trash = 0; | 5921 | delete_by_moving_to_trash = 0; |
| 5923 | Qdelete_by_moving_to_trash = intern_c_string ("delete-by-moving-to-trash"); | 5922 | Qdelete_by_moving_to_trash = intern_c_string ("delete-by-moving-to-trash"); |
| 5924 | Qmove_file_to_trash = intern_c_string ("move-file-to-trash"); | 5923 | Qmove_file_to_trash = intern_c_string ("move-file-to-trash"); |
diff --git a/src/lisp.h b/src/lisp.h index b4ff446b064..e17931ca366 100644 --- a/src/lisp.h +++ b/src/lisp.h | |||
| @@ -3060,7 +3060,7 @@ EXFUN (Fread_file_name, 6); | |||
| 3060 | extern Lisp_Object close_file_unwind P_ ((Lisp_Object)); | 3060 | extern Lisp_Object close_file_unwind P_ ((Lisp_Object)); |
| 3061 | extern Lisp_Object restore_point_unwind P_ ((Lisp_Object)); | 3061 | extern Lisp_Object restore_point_unwind P_ ((Lisp_Object)); |
| 3062 | extern void report_file_error P_ ((const char *, Lisp_Object)) NO_RETURN; | 3062 | extern void report_file_error P_ ((const char *, Lisp_Object)) NO_RETURN; |
| 3063 | extern int internal_delete_file P_ ((Lisp_Object, Lisp_Object)); | 3063 | extern int internal_delete_file P_ ((Lisp_Object)); |
| 3064 | extern void syms_of_fileio P_ ((void)); | 3064 | extern void syms_of_fileio P_ ((void)); |
| 3065 | extern Lisp_Object make_temp_name P_ ((Lisp_Object, int)); | 3065 | extern Lisp_Object make_temp_name P_ ((Lisp_Object, int)); |
| 3066 | EXFUN (Fmake_symbolic_link, 3); | 3066 | EXFUN (Fmake_symbolic_link, 3); |