From 53967e09ad89f11531c7fee0240c2eac1f63922c Mon Sep 17 00:00:00 2001 From: Chong Yidong Date: Mon, 3 May 2010 11:01:21 -0400 Subject: Add optional arg to delete-file to force deletion (Bug#6070). * eval.c (internal_condition_case_n): Rename from internal_condition_case_2. (internal_condition_case_2): New function. * xdisp.c (safe_call): Use internal_condition_case_n. * fileio.c (Fdelete_file, internal_delete_file): New arg FORCE. (internal_delete_file, Frename_file): Callers changed. * buffer.c (Fkill_buffer): * callproc.c (delete_temp_file): Callers changed (Bug#6070). * lisp.h: Update prototypes. * diff.el (diff-sentinel): * epg.el (epg--make-temp-file, epg-decrypt-string) (epg-verify-string, epg-sign-string, epg-encrypt-string): * jka-compr.el (jka-compr-partial-uncompress) (jka-compr-call-process, jka-compr-write-region, jka-compr-load): * server.el (server-sentinel): Use delete-file's new FORCE arg (Bug#6070). --- lisp/ChangeLog | 26 +++++++++++++------------- lisp/diff.el | 5 ++--- lisp/epg.el | 15 +++++---------- lisp/jka-compr.el | 12 ++++-------- lisp/server.el | 3 +-- 5 files changed, 25 insertions(+), 36 deletions(-) (limited to 'lisp') diff --git a/lisp/ChangeLog b/lisp/ChangeLog index ed61cb38389..1cc1bddaca2 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,16 @@ +2010-05-03 Chong Yidong + + * diff.el (diff-sentinel): + + * epg.el (epg--make-temp-file, epg-decrypt-string) + (epg-verify-string, epg-sign-string, epg-encrypt-string): + + * jka-compr.el (jka-compr-partial-uncompress) + (jka-compr-call-process, jka-compr-write-region, jka-compr-load): + + * server.el (server-sentinel): Use delete-file's new FORCE arg + (Bug#6070). + 2010-05-03 Stefan Monnier Use define-minor-mode where applicable. @@ -100,19 +113,6 @@ (tramp-handle-file-local-copy, tramp-handle-write-region) (tramp-method-out-of-band-p): Use `tramp-get-inline-coding'. -2010-05-01 Chong Yidong - - * server.el (server-sentinel, server-start, server-force-delete): - - * jka-compr.el (jka-compr-partial-uncompress) - (jka-compr-call-process, jka-compr-write-region, jka-compr-load): - - * epg.el (epg--make-temp-file, epg-decrypt-string) - (epg-encrypt-string, epg-verify-string, epg-sign-string): - - * diff.el (diff-sentinel): Bind delete-by-moving-to-trash to nil - before deleting (Bug#6070). - 2010-05-01 Stefan Monnier * bindings.el (mode-line-abbrev-mode, mode-line-auto-fill-mode): diff --git a/lisp/diff.el b/lisp/diff.el index 37e52baaaac..d7fc993ec33 100644 --- a/lisp/diff.el +++ b/lisp/diff.el @@ -64,9 +64,8 @@ "Code run when the diff process exits. CODE is the exit code of the process. It should be 0 only if no diffs were found." - (let (delete-by-moving-to-trash) - (if diff-old-temp-file (delete-file diff-old-temp-file)) - (if diff-new-temp-file (delete-file diff-new-temp-file))) + (if diff-old-temp-file (delete-file diff-old-temp-file t)) + (if diff-new-temp-file (delete-file diff-new-temp-file t)) (save-excursion (goto-char (point-max)) (let ((inhibit-read-only t)) diff --git a/lisp/epg.el b/lisp/epg.el index 668043ebeb7..7791c1865a7 100644 --- a/lisp/epg.el +++ b/lisp/epg.el @@ -1898,8 +1898,7 @@ You can then use `write-region' to write new data into the file." ;; Cleanup the tempfile. (and tempfile (file-exists-p tempfile) - (let (delete-by-moving-to-trash) - (delete-file tempfile))) + (delete-file tempfile t)) ;; Cleanup the tempdir. (and tempdir (file-directory-p tempdir) @@ -1999,8 +1998,7 @@ If PLAIN is nil, it returns the result as a string." (epg-read-output context)) (epg-delete-output-file context) (if (file-exists-p input-file) - (let (delete-by-moving-to-trash) - (delete-file input-file))) + (delete-file input-file t)) (epg-reset context)))) (defun epg-start-verify (context signature &optional signed-text) @@ -2097,8 +2095,7 @@ successful verification." (epg-delete-output-file context) (if (and input-file (file-exists-p input-file)) - (let (delete-by-moving-to-trash) - (delete-file input-file))) + (delete-file input-file)) (epg-reset context)))) (defun epg-start-sign (context plain &optional mode) @@ -2205,8 +2202,7 @@ Otherwise, it makes a cleartext signature." (epg-read-output context)) (epg-delete-output-file context) (if input-file - (let (delete-by-moving-to-trash) - (delete-file input-file))) + (delete-file input-file t)) (epg-reset context)))) (defun epg-start-encrypt (context plain recipients @@ -2326,8 +2322,7 @@ If RECIPIENTS is nil, it performs symmetric encryption." (epg-read-output context)) (epg-delete-output-file context) (if input-file - (let (delete-by-moving-to-trash) - (delete-file input-file))) + (delete-file input-file t)) (epg-reset context)))) (defun epg-start-export-keys (context keys) diff --git a/lisp/jka-compr.el b/lisp/jka-compr.el index 6df57d710e1..e4311e13f28 100644 --- a/lisp/jka-compr.el +++ b/lisp/jka-compr.el @@ -181,8 +181,7 @@ to keep: LEN chars starting BEG chars from the beginning." null-device)) jka-compr-acceptable-retval-list) (jka-compr-error prog args infile message err-file)) - (let (delete-by-moving-to-trash) - (delete-file err-file)))) + (delete-file err-file t))) ;; Run the uncompression program directly. ;; We get the whole file and must delete what we don't want. @@ -224,8 +223,7 @@ to keep: LEN chars starting BEG chars from the beginning." ""))) jka-compr-acceptable-retval-list) (jka-compr-error prog args infile message err-file)) - (let (delete-by-moving-to-trash) - (delete-file err-file)))) + (delete-file err-file t))) (or (eq 0 (apply 'call-process prog infile (if (stringp output) temp output) @@ -337,8 +335,7 @@ There should be no more than seven characters after the final `/'." (and append can-append) 'dont)) (erase-buffer)) ) - (let (delete-by-moving-to-trash) - (delete-file temp-file)) + (delete-file temp-file t) (and compress-message @@ -604,8 +601,7 @@ There should be no more than seven characters after the final `/'." (setq file (file-name-sans-extension file))) (setcar l file))) - (let (delete-by-moving-to-trash) - (delete-file local-copy))) + (delete-file local-copy)) t)) diff --git a/lisp/server.el b/lisp/server.el index 56819112639..6b5f2486332 100644 --- a/lisp/server.el +++ b/lisp/server.el @@ -345,8 +345,7 @@ If CLIENT is non-nil, add a description of it to the logged message." (and (process-contact proc :server) (eq (process-status proc) 'closed) (ignore-errors - (let (delete-by-moving-to-trash) - (delete-file (process-get proc :server-file))))) + (delete-file (process-get proc :server-file) t))) (server-log (format "Status changed to %s: %s" (process-status proc) msg) proc) (server-delete-client proc)) -- cgit v1.2.1