Avoid using trash for certain temp files (Bug#6070).
* 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).
This commit is contained in:
parent
07125a915e
commit
84716442f0
5 changed files with 42 additions and 17 deletions
|
@ -1,3 +1,16 @@
|
|||
2010-05-01 Chong Yidong <cyd@stupidchicken.com>
|
||||
|
||||
* 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 <monnier@iro.umontreal.ca>
|
||||
|
||||
* bindings.el (mode-line-abbrev-mode, mode-line-auto-fill-mode):
|
||||
|
|
|
@ -64,8 +64,9 @@
|
|||
"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."
|
||||
(if diff-old-temp-file (delete-file diff-old-temp-file))
|
||||
(if diff-new-temp-file (delete-file diff-new-temp-file))
|
||||
(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)))
|
||||
(save-excursion
|
||||
(goto-char (point-max))
|
||||
(let ((inhibit-read-only t))
|
||||
|
|
15
lisp/epg.el
15
lisp/epg.el
|
@ -1898,7 +1898,8 @@ You can then use `write-region' to write new data into the file."
|
|||
;; Cleanup the tempfile.
|
||||
(and tempfile
|
||||
(file-exists-p tempfile)
|
||||
(delete-file tempfile))
|
||||
(let (delete-by-moving-to-trash)
|
||||
(delete-file tempfile)))
|
||||
;; Cleanup the tempdir.
|
||||
(and tempdir
|
||||
(file-directory-p tempdir)
|
||||
|
@ -1998,7 +1999,8 @@ 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)
|
||||
(delete-file input-file))
|
||||
(let (delete-by-moving-to-trash)
|
||||
(delete-file input-file)))
|
||||
(epg-reset context))))
|
||||
|
||||
(defun epg-start-verify (context signature &optional signed-text)
|
||||
|
@ -2095,7 +2097,8 @@ successful verification."
|
|||
(epg-delete-output-file context)
|
||||
(if (and input-file
|
||||
(file-exists-p input-file))
|
||||
(delete-file input-file))
|
||||
(let (delete-by-moving-to-trash)
|
||||
(delete-file input-file)))
|
||||
(epg-reset context))))
|
||||
|
||||
(defun epg-start-sign (context plain &optional mode)
|
||||
|
@ -2202,7 +2205,8 @@ Otherwise, it makes a cleartext signature."
|
|||
(epg-read-output context))
|
||||
(epg-delete-output-file context)
|
||||
(if input-file
|
||||
(delete-file input-file))
|
||||
(let (delete-by-moving-to-trash)
|
||||
(delete-file input-file)))
|
||||
(epg-reset context))))
|
||||
|
||||
(defun epg-start-encrypt (context plain recipients
|
||||
|
@ -2322,7 +2326,8 @@ If RECIPIENTS is nil, it performs symmetric encryption."
|
|||
(epg-read-output context))
|
||||
(epg-delete-output-file context)
|
||||
(if input-file
|
||||
(delete-file input-file))
|
||||
(let (delete-by-moving-to-trash)
|
||||
(delete-file input-file)))
|
||||
(epg-reset context))))
|
||||
|
||||
(defun epg-start-export-keys (context keys)
|
||||
|
|
|
@ -181,7 +181,9 @@ 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))
|
||||
(jka-compr-delete-temp-file err-file)))
|
||||
(let (delete-by-moving-to-trash)
|
||||
(delete-file err-file))))
|
||||
|
||||
;; Run the uncompression program directly.
|
||||
;; We get the whole file and must delete what we don't want.
|
||||
(jka-compr-call-process prog message infile t nil args))
|
||||
|
@ -222,7 +224,8 @@ to keep: LEN chars starting BEG chars from the beginning."
|
|||
"")))
|
||||
jka-compr-acceptable-retval-list)
|
||||
(jka-compr-error prog args infile message err-file))
|
||||
(jka-compr-delete-temp-file err-file)))
|
||||
(let (delete-by-moving-to-trash)
|
||||
(delete-file err-file))))
|
||||
(or (eq 0
|
||||
(apply 'call-process
|
||||
prog infile (if (stringp output) temp output)
|
||||
|
@ -248,9 +251,6 @@ There should be no more than seven characters after the final `/'."
|
|||
"This routine will return the name of a new file."
|
||||
(make-temp-file jka-compr-temp-name-template))
|
||||
|
||||
(defalias 'jka-compr-delete-temp-file 'delete-file)
|
||||
|
||||
|
||||
(defun jka-compr-write-region (start end file &optional append visit)
|
||||
(let* ((filename (expand-file-name file))
|
||||
(visit-file (if (stringp visit) (expand-file-name visit) filename))
|
||||
|
@ -337,7 +337,8 @@ There should be no more than seven characters after the final `/'."
|
|||
(and append can-append) 'dont))
|
||||
(erase-buffer)) )
|
||||
|
||||
(jka-compr-delete-temp-file temp-file)
|
||||
(let (delete-by-moving-to-trash)
|
||||
(delete-file temp-file))
|
||||
|
||||
(and
|
||||
compress-message
|
||||
|
@ -603,7 +604,8 @@ There should be no more than seven characters after the final `/'."
|
|||
(setq file (file-name-sans-extension file)))
|
||||
(setcar l file)))
|
||||
|
||||
(jka-compr-delete-temp-file local-copy))
|
||||
(let (delete-by-moving-to-trash)
|
||||
(delete-file local-copy)))
|
||||
|
||||
t))
|
||||
|
||||
|
|
|
@ -344,7 +344,9 @@ If CLIENT is non-nil, add a description of it to the logged message."
|
|||
;; for possible servers before doing anything, so it *should* be ours.
|
||||
(and (process-contact proc :server)
|
||||
(eq (process-status proc) 'closed)
|
||||
(ignore-errors (delete-file (process-get proc :server-file))))
|
||||
(ignore-errors
|
||||
(let (delete-by-moving-to-trash)
|
||||
(delete-file (process-get proc :server-file)))))
|
||||
(server-log (format "Status changed to %s: %s" (process-status proc) msg) proc)
|
||||
(server-delete-client proc))
|
||||
|
||||
|
@ -517,7 +519,9 @@ To force-start a server, do \\[server-force-delete] and then
|
|||
;; Delete the socket files made by previous server invocations.
|
||||
(if (not (eq t (server-running-p server-name)))
|
||||
;; Remove any leftover socket or authentication file
|
||||
(ignore-errors (delete-file server-file))
|
||||
(ignore-errors
|
||||
(let (delete-by-moving-to-trash)
|
||||
(delete-file server-file)))
|
||||
(setq server-mode nil) ;; already set by the minor mode code
|
||||
(display-warning
|
||||
'server
|
||||
|
@ -600,7 +604,7 @@ NAME defaults to `server-name'. With argument, ask for NAME."
|
|||
server-auth-dir
|
||||
server-socket-dir))))
|
||||
(condition-case nil
|
||||
(progn
|
||||
(let (delete-by-moving-to-trash)
|
||||
(delete-file file)
|
||||
(message "Connection file %S deleted" file))
|
||||
(file-error
|
||||
|
|
Loading…
Add table
Reference in a new issue