diff options
| author | Chong Yidong | 2010-05-27 19:30:11 -0400 |
|---|---|---|
| committer | Chong Yidong | 2010-05-27 19:30:11 -0400 |
| commit | f1a5d776c4985b3ff1a2c6c17dd71dedf5d726e8 (patch) | |
| tree | 64e61e6b8ea6b3a2f10bb090d26823dfcef4b4d0 | |
| parent | f44a59e61a98543d4ce8b6952f1946dd955ce988 (diff) | |
| download | emacs-f1a5d776c4985b3ff1a2c6c17dd71dedf5d726e8.tar.gz emacs-f1a5d776c4985b3ff1a2c6c17dd71dedf5d726e8.zip | |
Change delete-by-moving-to-trash so Lisp calls explicitly request trashing.
* src/fileio.c (Fdelete_file): Change meaning of optional arg to mean
whether to trash.
(internal_delete_file, Frename_file): Callers changed.
(delete_by_moving_to_trash): Doc fix.
(Fdelete_directory_internal): Don't move to trash.
* src/callproc.c (delete_temp_file):
* src/buffer.c (Fkill_buffer): Callers changed.
* src/lisp.h: Update prototype.
* lisp/diff.el (diff-sentinel):
* lisp/epg.el (epg--make-temp-file, epg-decrypt-string)
(epg-verify-string, epg-sign-string, epg-encrypt-string):
* lisp/jka-compr.el (jka-compr-partial-uncompress)
(jka-compr-call-process, jka-compr-write-region):
* lisp/server.el (server-sentinel): Remove optional arg from
delete-file, reverting 2010-05-03 change.
* lisp/dired.el (dired-delete-file): New arg TRASH.
(dired-internal-do-deletions): New arg TRASH. Use progress
reporter.
(dired-do-flagged-delete, dired-do-delete): Use trash.
* lisp/files.el (delete-directory): New arg TRASH.
* lisp/speedbar.el (speedbar-item-delete): Allow trashing.
* lisp/net/ange-ftp.el (ange-ftp-del-tmp-name, ange-ftp-delete-file)
(ange-ftp-rename-remote-to-remote)
(ange-ftp-rename-local-to-remote)
(ange-ftp-rename-remote-to-local, ange-ftp-load)
(ange-ftp-compress, ange-ftp-uncompress): Remove optional arg from
`delete-file'.
(ange-ftp-delete-directory): Add optional arg to `delete-file', to
allow trashing.
* lisp/net/tramp-compat.el (tramp-compat-delete-file): Rewrite to
handle new TRASH arg of `delete-file'.
* lisp/net/tramp-fish.el (tramp-fish-handle-delete-directory)
(tramp-fish-handle-delete-file)
(tramp-fish-handle-make-symbolic-link)
(tramp-fish-handle-process-file): Use null TRASH arg in
`tramp-compat-delete-file' call.
* lisp/net/tramp-ftp.el (tramp-ftp-file-name-handler): Use null TRASH
arg in `tramp-compat-delete-file' call.
* lisp/net/tramp-gvfs.el (tramp-gvfs-handle-delete-file): Rename arg.
(tramp-gvfs-handle-write-region): Use null TRASH arg in
`tramp-compat-delete-file' call.
* lisp/net/tramp-imap.el (tramp-imap-handle-delete-file): Rename arg.
(tramp-imap-do-copy-or-rename-file): Use null TRASH arg in
`tramp-compat-delete-file' call.
* lisp/net/tramp-smb.el (tramp-smb-handle-copy-file)
(tramp-smb-handle-file-local-copy, tramp-smb-handle-rename-file)
(tramp-smb-handle-write-region): Use null TRASH arg in
tramp-compat-delete-file call.
(tramp-smb-handle-delete-directory): Use tramp-compat-delete-file.
(tramp-smb-handle-delete-file): Rename arg.
* lisp/net/tramp.el (tramp-handle-delete-file): Change FORCE arg to TRASH.
(tramp-handle-make-symbolic-link, tramp-handle-load)
(tramp-do-copy-or-rename-file-via-buffer)
(tramp-do-copy-or-rename-file-directly)
(tramp-do-copy-or-rename-file-out-of-band)
(tramp-handle-process-file, tramp-handle-call-process-region)
(tramp-handle-shell-command, tramp-handle-file-local-copy)
(tramp-handle-insert-file-contents, tramp-handle-write-region)
(tramp-delete-temp-file-function): Use null TRASH arg in
tramp-compat-delete-file call.
| -rw-r--r-- | etc/NEWS | 18 | ||||
| -rw-r--r-- | lisp/ChangeLog | 67 | ||||
| -rw-r--r-- | lisp/diff.el | 4 | ||||
| -rw-r--r-- | lisp/dired.el | 39 | ||||
| -rw-r--r-- | lisp/epg.el | 8 | ||||
| -rw-r--r-- | lisp/files.el | 33 | ||||
| -rw-r--r-- | lisp/jka-compr.el | 6 | ||||
| -rw-r--r-- | lisp/net/ange-ftp.el | 21 | ||||
| -rw-r--r-- | lisp/net/tramp-compat.el | 27 | ||||
| -rw-r--r-- | lisp/net/tramp-fish.el | 18 | ||||
| -rw-r--r-- | lisp/net/tramp-ftp.el | 2 | ||||
| -rw-r--r-- | lisp/net/tramp-gvfs.el | 6 | ||||
| -rw-r--r-- | lisp/net/tramp-imap.el | 4 | ||||
| -rw-r--r-- | lisp/net/tramp-smb.el | 14 | ||||
| -rw-r--r-- | lisp/net/tramp.el | 39 | ||||
| -rw-r--r-- | lisp/server.el | 2 | ||||
| -rw-r--r-- | lisp/speedbar.el | 4 | ||||
| -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 |
22 files changed, 237 insertions, 135 deletions
| @@ -109,16 +109,20 @@ scroll a line instead of full screen. | |||
| 109 | ** New property `scroll-command' should be set on a command's symbol to | 109 | ** New property `scroll-command' should be set on a command's symbol to |
| 110 | define it as a scroll command affected by `scroll-preserve-screen-position. | 110 | define it as a scroll command affected by `scroll-preserve-screen-position. |
| 111 | 111 | ||
| 112 | ** Trash changes | ||
| 113 | |||
| 114 | *** `delete-by-moving-to-trash' now only affects commands that specify | ||
| 115 | trashing. This avoids inadvertently trashing temporary files. | ||
| 116 | |||
| 117 | *** Calling `delete-file' or `delete-directory' with a prefix argument | ||
| 118 | now forces true deletion, regardless of `delete-by-moving-to-trash'. | ||
| 119 | |||
| 112 | 120 | ||
| 113 | * Editing Changes in Emacs 24.1 | 121 | * Editing Changes in Emacs 24.1 |
| 114 | 122 | ||
| 115 | ** completion-at-point is now an alias for complete-symbol. | 123 | ** completion-at-point is now an alias for complete-symbol. |
| 116 | 124 | ||
| 117 | ** mouse-region-delete-keys has been deleted. | 125 | ** mouse-region-delete-keys has been deleted. |
| 118 | |||
| 119 | ** If delete-file is called with a prefix argument, it really deletes, | ||
| 120 | regardless of the value of `delete-by-moving-to-trash'. | ||
| 121 | |||
| 122 | 126 | ||
| 123 | * Changes in Specialized Modes and Packages in Emacs 24.1 | 127 | * Changes in Specialized Modes and Packages in Emacs 24.1 |
| 124 | 128 | ||
| @@ -237,8 +241,10 @@ secrets. | |||
| 237 | ** prog-mode is a new major-mode meant to be the parent of programming mode. | 241 | ** prog-mode is a new major-mode meant to be the parent of programming mode. |
| 238 | ** define-minor-mode accepts a new keyword :variable. | 242 | ** define-minor-mode accepts a new keyword :variable. |
| 239 | 243 | ||
| 240 | ** delete-file now accepts an optional second arg, FORCE, which says | 244 | ** `delete-file' and `delete-directory now accept optional arg TRASH. |
| 241 | to always delete and ignore the value of delete-by-moving-to-trash. | 245 | Trashing is performed if TRASH and `delete-by-moving-to-trash' are |
| 246 | both non-nil. Interactively, TRASH defaults to t, unless a prefix | ||
| 247 | argument is supplied (see Trash changes, above). | ||
| 242 | 248 | ||
| 243 | ** buffer-substring-filters is obsoleted by filter-buffer-substring-functions. | 249 | ** buffer-substring-filters is obsoleted by filter-buffer-substring-functions. |
| 244 | 250 | ||
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index a18eea12ee3..bc80b4cafe0 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,5 +1,72 @@ | |||
| 1 | 2010-05-27 Chong Yidong <cyd@stupidchicken.com> | 1 | 2010-05-27 Chong Yidong <cyd@stupidchicken.com> |
| 2 | 2 | ||
| 3 | * dired.el (dired-delete-file): New arg TRASH. | ||
| 4 | (dired-internal-do-deletions): New arg TRASH. Use progress | ||
| 5 | reporter. | ||
| 6 | (dired-do-flagged-delete, dired-do-delete): Use trash. | ||
| 7 | |||
| 8 | * speedbar.el (speedbar-item-delete): Allow trashing. | ||
| 9 | |||
| 10 | * files.el (delete-directory): New arg TRASH. | ||
| 11 | |||
| 12 | * net/ange-ftp.el (ange-ftp-del-tmp-name, ange-ftp-delete-file) | ||
| 13 | (ange-ftp-rename-remote-to-remote) | ||
| 14 | (ange-ftp-rename-local-to-remote) | ||
| 15 | (ange-ftp-rename-remote-to-local, ange-ftp-load) | ||
| 16 | (ange-ftp-compress, ange-ftp-uncompress): Remove optional arg from | ||
| 17 | `delete-file'. | ||
| 18 | (ange-ftp-delete-directory): Add optional arg to `delete-file', to | ||
| 19 | allow trashing. | ||
| 20 | |||
| 21 | * net/tramp-compat.el (tramp-compat-delete-file): Rewrite to | ||
| 22 | handle new TRASH arg of `delete-file'. | ||
| 23 | |||
| 24 | * net/tramp.el (tramp-handle-delete-file): Change FORCE arg to | ||
| 25 | TRASH. | ||
| 26 | (tramp-handle-make-symbolic-link, tramp-handle-load) | ||
| 27 | (tramp-do-copy-or-rename-file-via-buffer) | ||
| 28 | (tramp-do-copy-or-rename-file-directly) | ||
| 29 | (tramp-do-copy-or-rename-file-out-of-band) | ||
| 30 | (tramp-handle-process-file, tramp-handle-call-process-region) | ||
| 31 | (tramp-handle-shell-command, tramp-handle-file-local-copy) | ||
| 32 | (tramp-handle-insert-file-contents, tramp-handle-write-region) | ||
| 33 | (tramp-delete-temp-file-function): Use null TRASH arg in | ||
| 34 | tramp-compat-delete-file call. | ||
| 35 | |||
| 36 | * net/tramp-fish.el (tramp-fish-handle-delete-directory) | ||
| 37 | (tramp-fish-handle-delete-file) | ||
| 38 | (tramp-fish-handle-make-symbolic-link) | ||
| 39 | (tramp-fish-handle-process-file): Use null TRASH arg in | ||
| 40 | `tramp-compat-delete-file' call. | ||
| 41 | |||
| 42 | * net/tramp-ftp.el (tramp-ftp-file-name-handler): Use null TRASH | ||
| 43 | arg in `tramp-compat-delete-file' call. | ||
| 44 | |||
| 45 | * net/tramp-gvfs.el (tramp-gvfs-handle-delete-file): Rename arg. | ||
| 46 | (tramp-gvfs-handle-write-region): Use null TRASH arg in | ||
| 47 | `tramp-compat-delete-file' call. | ||
| 48 | |||
| 49 | * net/tramp-imap.el (tramp-imap-handle-delete-file): Rename arg. | ||
| 50 | (tramp-imap-do-copy-or-rename-file): Use null TRASH arg in | ||
| 51 | `tramp-compat-delete-file' call. | ||
| 52 | |||
| 53 | * net/tramp-smb.el (tramp-smb-handle-copy-file) | ||
| 54 | (tramp-smb-handle-file-local-copy, tramp-smb-handle-rename-file) | ||
| 55 | (tramp-smb-handle-write-region): Use null TRASH arg in | ||
| 56 | tramp-compat-delete-file call. | ||
| 57 | (tramp-smb-handle-delete-directory): Use tramp-compat-delete-file. | ||
| 58 | (tramp-smb-handle-delete-file): Rename arg. | ||
| 59 | |||
| 60 | * diff.el (diff-sentinel): | ||
| 61 | * epg.el (epg--make-temp-file, epg-decrypt-string) | ||
| 62 | (epg-verify-string, epg-sign-string, epg-encrypt-string): | ||
| 63 | * jka-compr.el (jka-compr-partial-uncompress) | ||
| 64 | (jka-compr-call-process, jka-compr-write-region): | ||
| 65 | * server.el (server-sentinel): Remove optional arg from | ||
| 66 | delete-file, reverting 2010-05-03 change. | ||
| 67 | |||
| 68 | 2010-05-27 Chong Yidong <cyd@stupidchicken.com> | ||
| 69 | |||
| 3 | * progmodes/verilog-mode.el (verilog-type-font-keywords): Use | 70 | * progmodes/verilog-mode.el (verilog-type-font-keywords): Use |
| 4 | font-lock-constant-face, not obsolete font-lock-reference-face. | 71 | font-lock-constant-face, not obsolete font-lock-reference-face. |
| 5 | 72 | ||
diff --git a/lisp/diff.el b/lisp/diff.el index d7fc993ec33..0206c17e770 100644 --- a/lisp/diff.el +++ b/lisp/diff.el | |||
| @@ -64,8 +64,8 @@ | |||
| 64 | "Code run when the diff process exits. | 64 | "Code run when the diff process exits. |
| 65 | CODE is the exit code of the process. It should be 0 only if no diffs | 65 | CODE is the exit code of the process. It should be 0 only if no diffs |
| 66 | were found." | 66 | were found." |
| 67 | (if diff-old-temp-file (delete-file diff-old-temp-file t)) | 67 | (if diff-old-temp-file (delete-file diff-old-temp-file)) |
| 68 | (if diff-new-temp-file (delete-file diff-new-temp-file t)) | 68 | (if diff-new-temp-file (delete-file diff-new-temp-file)) |
| 69 | (save-excursion | 69 | (save-excursion |
| 70 | (goto-char (point-max)) | 70 | (goto-char (point-max)) |
| 71 | (let ((inhibit-read-only t)) | 71 | (let ((inhibit-read-only t)) |
diff --git a/lisp/dired.el b/lisp/dired.el index 531f329b26a..4fe804dd46d 100644 --- a/lisp/dired.el +++ b/lisp/dired.el | |||
| @@ -2579,7 +2579,7 @@ Anything else means ask for each directory." | |||
| 2579 | ;; Delete file, possibly delete a directory and all its files. | 2579 | ;; Delete file, possibly delete a directory and all its files. |
| 2580 | ;; This function is usefull outside of dired. One could change it's name | 2580 | ;; This function is usefull outside of dired. One could change it's name |
| 2581 | ;; to e.g. recursive-delete-file and put it somewhere else. | 2581 | ;; to e.g. recursive-delete-file and put it somewhere else. |
| 2582 | (defun dired-delete-file (file &optional recursive) "\ | 2582 | (defun dired-delete-file (file &optional recursive trash) "\ |
| 2583 | Delete FILE or directory (possibly recursively if optional RECURSIVE is true.) | 2583 | Delete FILE or directory (possibly recursively if optional RECURSIVE is true.) |
| 2584 | RECURSIVE determines what to do with a non-empty directory. If RECURSIVE is: | 2584 | RECURSIVE determines what to do with a non-empty directory. If RECURSIVE is: |
| 2585 | nil, do not delete. | 2585 | nil, do not delete. |
| @@ -2590,15 +2590,19 @@ Anything else, ask for each sub-directory." | |||
| 2590 | ;; (and (file-directory-p fn) (not (file-symlink-p fn))) | 2590 | ;; (and (file-directory-p fn) (not (file-symlink-p fn))) |
| 2591 | ;; but more efficient | 2591 | ;; but more efficient |
| 2592 | (if (not (eq t (car (file-attributes file)))) | 2592 | (if (not (eq t (car (file-attributes file)))) |
| 2593 | (delete-file file) | 2593 | (delete-file file trash) |
| 2594 | (if (and recursive | 2594 | (if (and recursive |
| 2595 | (directory-files file t dired-re-no-dot) ; Not empty. | 2595 | (directory-files file t dired-re-no-dot) ; Not empty. |
| 2596 | (or (eq recursive 'always) | 2596 | (or (eq recursive 'always) |
| 2597 | (yes-or-no-p (format "Recursive delete of %s? " | 2597 | (yes-or-no-p (format "Recursively %s %s? " |
| 2598 | (if (and trash | ||
| 2599 | delete-by-moving-to-trash) | ||
| 2600 | "trash" | ||
| 2601 | "delete") | ||
| 2598 | (dired-make-relative file))))) | 2602 | (dired-make-relative file))))) |
| 2599 | (if (eq recursive 'top) (setq recursive 'always)) ; Don't ask again. | 2603 | (if (eq recursive 'top) (setq recursive 'always)) ; Don't ask again. |
| 2600 | (setq recursive nil)) | 2604 | (setq recursive nil)) |
| 2601 | (delete-directory file recursive))) | 2605 | (delete-directory file recursive trash))) |
| 2602 | 2606 | ||
| 2603 | (defun dired-do-flagged-delete (&optional nomessage) | 2607 | (defun dired-do-flagged-delete (&optional nomessage) |
| 2604 | "In Dired, delete the files flagged for deletion. | 2608 | "In Dired, delete the files flagged for deletion. |
| @@ -2616,7 +2620,7 @@ non-empty directories is allowed." | |||
| 2616 | ;; this can't move point since ARG is nil | 2620 | ;; this can't move point since ARG is nil |
| 2617 | (dired-map-over-marks (cons (dired-get-filename) (point)) | 2621 | (dired-map-over-marks (cons (dired-get-filename) (point)) |
| 2618 | nil) | 2622 | nil) |
| 2619 | nil) | 2623 | nil t) |
| 2620 | (or nomessage | 2624 | (or nomessage |
| 2621 | (message "(No deletions requested)"))))) | 2625 | (message "(No deletions requested)"))))) |
| 2622 | 2626 | ||
| @@ -2631,11 +2635,11 @@ non-empty directories is allowed." | |||
| 2631 | ;; this may move point if ARG is an integer | 2635 | ;; this may move point if ARG is an integer |
| 2632 | (dired-map-over-marks (cons (dired-get-filename) (point)) | 2636 | (dired-map-over-marks (cons (dired-get-filename) (point)) |
| 2633 | arg) | 2637 | arg) |
| 2634 | arg)) | 2638 | arg t)) |
| 2635 | 2639 | ||
| 2636 | (defvar dired-deletion-confirmer 'yes-or-no-p) ; or y-or-n-p? | 2640 | (defvar dired-deletion-confirmer 'yes-or-no-p) ; or y-or-n-p? |
| 2637 | 2641 | ||
| 2638 | (defun dired-internal-do-deletions (l arg) | 2642 | (defun dired-internal-do-deletions (l arg &optional trash) |
| 2639 | ;; L is an alist of files to delete, with their buffer positions. | 2643 | ;; L is an alist of files to delete, with their buffer positions. |
| 2640 | ;; ARG is the prefix arg. | 2644 | ;; ARG is the prefix arg. |
| 2641 | ;; Filenames are absolute. | 2645 | ;; Filenames are absolute. |
| @@ -2644,14 +2648,21 @@ non-empty directories is allowed." | |||
| 2644 | ;; lines still to be changed, so the (point) values in L stay valid. | 2648 | ;; lines still to be changed, so the (point) values in L stay valid. |
| 2645 | ;; Also, for subdirs in natural order, a subdir's files are deleted | 2649 | ;; Also, for subdirs in natural order, a subdir's files are deleted |
| 2646 | ;; before the subdir itself - the other way around would not work. | 2650 | ;; before the subdir itself - the other way around would not work. |
| 2647 | (let ((files (mapcar (function car) l)) | 2651 | (let* ((files (mapcar (function car) l)) |
| 2648 | (count (length l)) | 2652 | (count (length l)) |
| 2649 | (succ 0)) | 2653 | (succ 0) |
| 2654 | (trashing (and trash delete-by-moving-to-trash)) | ||
| 2655 | (progress-reporter | ||
| 2656 | (make-progress-reporter | ||
| 2657 | (if trashing "Trashing..." "Deleting...") | ||
| 2658 | succ count))) | ||
| 2650 | ;; canonicalize file list for pop up | 2659 | ;; canonicalize file list for pop up |
| 2651 | (setq files (nreverse (mapcar (function dired-make-relative) files))) | 2660 | (setq files (nreverse (mapcar (function dired-make-relative) files))) |
| 2652 | (if (dired-mark-pop-up | 2661 | (if (dired-mark-pop-up |
| 2653 | " *Deletions*" 'delete files dired-deletion-confirmer | 2662 | " *Deletions*" 'delete files dired-deletion-confirmer |
| 2654 | (format "Delete %s " (dired-mark-prompt arg files))) | 2663 | (format "%s %s " |
| 2664 | (if trashing "Trash" "Delete") | ||
| 2665 | (dired-mark-prompt arg files))) | ||
| 2655 | (save-excursion | 2666 | (save-excursion |
| 2656 | (let (failures);; files better be in reverse order for this loop! | 2667 | (let (failures);; files better be in reverse order for this loop! |
| 2657 | (while l | 2668 | (while l |
| @@ -2659,10 +2670,10 @@ non-empty directories is allowed." | |||
| 2659 | (let ((inhibit-read-only t)) | 2670 | (let ((inhibit-read-only t)) |
| 2660 | (condition-case err | 2671 | (condition-case err |
| 2661 | (let ((fn (car (car l)))) | 2672 | (let ((fn (car (car l)))) |
| 2662 | (dired-delete-file fn dired-recursive-deletes) | 2673 | (dired-delete-file fn dired-recursive-deletes trash) |
| 2663 | ;; if we get here, removing worked | 2674 | ;; if we get here, removing worked |
| 2664 | (setq succ (1+ succ)) | 2675 | (setq succ (1+ succ)) |
| 2665 | (message "%s of %s deletions" succ count) | 2676 | (progress-reporter-update progress-reporter succ) |
| 2666 | (dired-fun-in-all-buffers | 2677 | (dired-fun-in-all-buffers |
| 2667 | (file-name-directory fn) (file-name-nondirectory fn) | 2678 | (file-name-directory fn) (file-name-nondirectory fn) |
| 2668 | (function dired-delete-entry) fn)) | 2679 | (function dired-delete-entry) fn)) |
| @@ -2671,7 +2682,7 @@ non-empty directories is allowed." | |||
| 2671 | (setq failures (cons (car (car l)) failures))))) | 2682 | (setq failures (cons (car (car l)) failures))))) |
| 2672 | (setq l (cdr l))) | 2683 | (setq l (cdr l))) |
| 2673 | (if (not failures) | 2684 | (if (not failures) |
| 2674 | (message "%d deletion%s done" count (dired-plural-s count)) | 2685 | (progress-reporter-done progress-reporter) |
| 2675 | (dired-log-summary | 2686 | (dired-log-summary |
| 2676 | (format "%d of %d deletion%s failed" | 2687 | (format "%d of %d deletion%s failed" |
| 2677 | (length failures) count | 2688 | (length failures) count |
diff --git a/lisp/epg.el b/lisp/epg.el index 6e69ae09da4..9a75560704a 100644 --- a/lisp/epg.el +++ b/lisp/epg.el | |||
| @@ -1899,7 +1899,7 @@ You can then use `write-region' to write new data into the file." | |||
| 1899 | ;; Cleanup the tempfile. | 1899 | ;; Cleanup the tempfile. |
| 1900 | (and tempfile | 1900 | (and tempfile |
| 1901 | (file-exists-p tempfile) | 1901 | (file-exists-p tempfile) |
| 1902 | (delete-file tempfile t)) | 1902 | (delete-file tempfile)) |
| 1903 | ;; Cleanup the tempdir. | 1903 | ;; Cleanup the tempdir. |
| 1904 | (and tempdir | 1904 | (and tempdir |
| 1905 | (file-directory-p tempdir) | 1905 | (file-directory-p tempdir) |
| @@ -1999,7 +1999,7 @@ If PLAIN is nil, it returns the result as a string." | |||
| 1999 | (epg-read-output context)) | 1999 | (epg-read-output context)) |
| 2000 | (epg-delete-output-file context) | 2000 | (epg-delete-output-file context) |
| 2001 | (if (file-exists-p input-file) | 2001 | (if (file-exists-p input-file) |
| 2002 | (delete-file input-file t)) | 2002 | (delete-file input-file)) |
| 2003 | (epg-reset context)))) | 2003 | (epg-reset context)))) |
| 2004 | 2004 | ||
| 2005 | (defun epg-start-verify (context signature &optional signed-text) | 2005 | (defun epg-start-verify (context signature &optional signed-text) |
| @@ -2203,7 +2203,7 @@ Otherwise, it makes a cleartext signature." | |||
| 2203 | (epg-read-output context)) | 2203 | (epg-read-output context)) |
| 2204 | (epg-delete-output-file context) | 2204 | (epg-delete-output-file context) |
| 2205 | (if input-file | 2205 | (if input-file |
| 2206 | (delete-file input-file t)) | 2206 | (delete-file input-file)) |
| 2207 | (epg-reset context)))) | 2207 | (epg-reset context)))) |
| 2208 | 2208 | ||
| 2209 | (defun epg-start-encrypt (context plain recipients | 2209 | (defun epg-start-encrypt (context plain recipients |
| @@ -2323,7 +2323,7 @@ If RECIPIENTS is nil, it performs symmetric encryption." | |||
| 2323 | (epg-read-output context)) | 2323 | (epg-read-output context)) |
| 2324 | (epg-delete-output-file context) | 2324 | (epg-delete-output-file context) |
| 2325 | (if input-file | 2325 | (if input-file |
| 2326 | (delete-file input-file t)) | 2326 | (delete-file input-file)) |
| 2327 | (epg-reset context)))) | 2327 | (epg-reset context)))) |
| 2328 | 2328 | ||
| 2329 | (defun epg-start-export-keys (context keys) | 2329 | (defun epg-start-export-keys (context keys) |
diff --git a/lisp/files.el b/lisp/files.el index d4c05bdc5d6..4ab583d018b 100644 --- a/lisp/files.el +++ b/lisp/files.el | |||
| @@ -4675,19 +4675,30 @@ this happens by default." | |||
| 4675 | "^\\([^.]\\|\\.\\([^.]\\|\\..\\)\\).*" | 4675 | "^\\([^.]\\|\\.\\([^.]\\|\\..\\)\\).*" |
| 4676 | "Regexp of file names excluging \".\" an \"..\".") | 4676 | "Regexp of file names excluging \".\" an \"..\".") |
| 4677 | 4677 | ||
| 4678 | (defun delete-directory (directory &optional recursive) | 4678 | (defun delete-directory (directory &optional recursive trash) |
| 4679 | "Delete the directory named DIRECTORY. Does not follow symlinks. | 4679 | "Delete the directory named DIRECTORY. Does not follow symlinks. |
| 4680 | If RECURSIVE is non-nil, all files in DIRECTORY are deleted as well." | 4680 | If RECURSIVE is non-nil, all files in DIRECTORY are deleted as well. |
| 4681 | TRASH non-nil means to trash the directory instead, provided | ||
| 4682 | `delete-by-moving-to-trash' is non-nil. | ||
| 4683 | |||
| 4684 | When called interactively, TRASH is t if no prefix argument is | ||
| 4685 | given. With a prefix argument, TRASH is nil." | ||
| 4681 | (interactive | 4686 | (interactive |
| 4682 | (let ((dir (expand-file-name | 4687 | (let* ((trashing (and delete-by-moving-to-trash |
| 4683 | (read-file-name | 4688 | (null current-prefix-arg))) |
| 4684 | "Delete directory: " | 4689 | (dir (expand-file-name |
| 4685 | default-directory default-directory nil nil)))) | 4690 | (read-file-name |
| 4691 | (if trashing | ||
| 4692 | "Move directory to trash: " | ||
| 4693 | "Delete directory: ") | ||
| 4694 | default-directory default-directory nil nil)))) | ||
| 4686 | (list dir | 4695 | (list dir |
| 4687 | (if (directory-files dir nil directory-files-no-dot-files-regexp) | 4696 | (if (directory-files dir nil directory-files-no-dot-files-regexp) |
| 4688 | (y-or-n-p | 4697 | (y-or-n-p |
| 4689 | (format "Directory `%s' is not empty, really delete? " dir)) | 4698 | (format "Directory `%s' is not empty, really %s? " |
| 4690 | nil)))) | 4699 | dir (if trashing "trash" "delete"))) |
| 4700 | nil) | ||
| 4701 | (null current-prefix-arg)))) | ||
| 4691 | ;; If default-directory is a remote directory, make sure we find its | 4702 | ;; If default-directory is a remote directory, make sure we find its |
| 4692 | ;; delete-directory handler. | 4703 | ;; delete-directory handler. |
| 4693 | (setq directory (directory-file-name (expand-file-name directory))) | 4704 | (setq directory (directory-file-name (expand-file-name directory))) |
| @@ -4695,7 +4706,7 @@ If RECURSIVE is non-nil, all files in DIRECTORY are deleted as well." | |||
| 4695 | (cond | 4706 | (cond |
| 4696 | (handler | 4707 | (handler |
| 4697 | (funcall handler 'delete-directory directory recursive)) | 4708 | (funcall handler 'delete-directory directory recursive)) |
| 4698 | (delete-by-moving-to-trash | 4709 | ((and delete-by-moving-to-trash trash) |
| 4699 | ;; Only move non-empty dir to trash if recursive deletion was | 4710 | ;; Only move non-empty dir to trash if recursive deletion was |
| 4700 | ;; requested. This mimics the non-`delete-by-moving-to-trash' | 4711 | ;; requested. This mimics the non-`delete-by-moving-to-trash' |
| 4701 | ;; case, where the operation fails in delete-directory-internal. | 4712 | ;; case, where the operation fails in delete-directory-internal. |
| @@ -4715,8 +4726,8 @@ If RECURSIVE is non-nil, all files in DIRECTORY are deleted as well." | |||
| 4715 | ;; (and (file-directory-p fn) (not (file-symlink-p fn))) | 4726 | ;; (and (file-directory-p fn) (not (file-symlink-p fn))) |
| 4716 | ;; but more efficient | 4727 | ;; but more efficient |
| 4717 | (if (eq t (car (file-attributes file))) | 4728 | (if (eq t (car (file-attributes file))) |
| 4718 | (delete-directory file recursive) | 4729 | (delete-directory file recursive nil) |
| 4719 | (delete-file file))) | 4730 | (delete-file file nil))) |
| 4720 | ;; We do not want to delete "." and "..". | 4731 | ;; We do not want to delete "." and "..". |
| 4721 | (directory-files | 4732 | (directory-files |
| 4722 | directory 'full directory-files-no-dot-files-regexp))) | 4733 | directory 'full directory-files-no-dot-files-regexp))) |
diff --git a/lisp/jka-compr.el b/lisp/jka-compr.el index e4311e13f28..3f0ff542212 100644 --- a/lisp/jka-compr.el +++ b/lisp/jka-compr.el | |||
| @@ -181,7 +181,7 @@ to keep: LEN chars starting BEG chars from the beginning." | |||
| 181 | null-device)) | 181 | null-device)) |
| 182 | jka-compr-acceptable-retval-list) | 182 | jka-compr-acceptable-retval-list) |
| 183 | (jka-compr-error prog args infile message err-file)) | 183 | (jka-compr-error prog args infile message err-file)) |
| 184 | (delete-file err-file t))) | 184 | (delete-file err-file))) |
| 185 | 185 | ||
| 186 | ;; Run the uncompression program directly. | 186 | ;; Run the uncompression program directly. |
| 187 | ;; We get the whole file and must delete what we don't want. | 187 | ;; We get the whole file and must delete what we don't want. |
| @@ -223,7 +223,7 @@ to keep: LEN chars starting BEG chars from the beginning." | |||
| 223 | ""))) | 223 | ""))) |
| 224 | jka-compr-acceptable-retval-list) | 224 | jka-compr-acceptable-retval-list) |
| 225 | (jka-compr-error prog args infile message err-file)) | 225 | (jka-compr-error prog args infile message err-file)) |
| 226 | (delete-file err-file t))) | 226 | (delete-file err-file))) |
| 227 | (or (eq 0 | 227 | (or (eq 0 |
| 228 | (apply 'call-process | 228 | (apply 'call-process |
| 229 | prog infile (if (stringp output) temp output) | 229 | prog infile (if (stringp output) temp output) |
| @@ -335,7 +335,7 @@ There should be no more than seven characters after the final `/'." | |||
| 335 | (and append can-append) 'dont)) | 335 | (and append can-append) 'dont)) |
| 336 | (erase-buffer)) ) | 336 | (erase-buffer)) ) |
| 337 | 337 | ||
| 338 | (delete-file temp-file t) | 338 | (delete-file temp-file) |
| 339 | 339 | ||
| 340 | (and | 340 | (and |
| 341 | compress-message | 341 | compress-message |
diff --git a/lisp/net/ange-ftp.el b/lisp/net/ange-ftp.el index 73cb2e57bb2..dcc6ddabcdc 100644 --- a/lisp/net/ange-ftp.el +++ b/lisp/net/ange-ftp.el | |||
| @@ -1736,7 +1736,7 @@ good, skip, fatal, or unknown." | |||
| 1736 | 1736 | ||
| 1737 | (defun ange-ftp-del-tmp-name (filename) | 1737 | (defun ange-ftp-del-tmp-name (filename) |
| 1738 | "Force to delete temporary file." | 1738 | "Force to delete temporary file." |
| 1739 | (delete-file filename 'force)) | 1739 | (delete-file filename)) |
| 1740 | 1740 | ||
| 1741 | 1741 | ||
| 1742 | ;;;; ------------------------------------------------------------ | 1742 | ;;;; ------------------------------------------------------------ |
| @@ -3507,8 +3507,9 @@ system TYPE.") | |||
| 3507 | (file-exists-p file) | 3507 | (file-exists-p file) |
| 3508 | (ange-ftp-real-file-executable-p file)))) | 3508 | (ange-ftp-real-file-executable-p file)))) |
| 3509 | 3509 | ||
| 3510 | (defun ange-ftp-delete-file (file &optional force) | 3510 | (defun ange-ftp-delete-file (file &optional trash) |
| 3511 | (interactive "fDelete file: ") | 3511 | (interactive (list (read-file-name "Delete file: " nil default-directory) |
| 3512 | (null current-prefix-arg))) | ||
| 3512 | (setq file (expand-file-name file)) | 3513 | (setq file (expand-file-name file)) |
| 3513 | (let ((parsed (ange-ftp-ftp-name file))) | 3514 | (let ((parsed (ange-ftp-ftp-name file))) |
| 3514 | (if parsed | 3515 | (if parsed |
| @@ -3526,7 +3527,7 @@ system TYPE.") | |||
| 3526 | (format "FTP Error: \"%s\"" (cdr result)) | 3527 | (format "FTP Error: \"%s\"" (cdr result)) |
| 3527 | file))) | 3528 | file))) |
| 3528 | (ange-ftp-delete-file-entry file)) | 3529 | (ange-ftp-delete-file-entry file)) |
| 3529 | (ange-ftp-real-delete-file file force)))) | 3530 | (ange-ftp-real-delete-file file trash)))) |
| 3530 | 3531 | ||
| 3531 | (defun ange-ftp-file-modtime (file) | 3532 | (defun ange-ftp-file-modtime (file) |
| 3532 | "Return the modification time of remote file FILE. | 3533 | "Return the modification time of remote file FILE. |
| @@ -3897,7 +3898,7 @@ E.g., | |||
| 3897 | (ange-ftp-add-file-entry newname) | 3898 | (ange-ftp-add-file-entry newname) |
| 3898 | (ange-ftp-delete-file-entry filename)) | 3899 | (ange-ftp-delete-file-entry filename)) |
| 3899 | (ange-ftp-copy-file-internal filename newname t nil) | 3900 | (ange-ftp-copy-file-internal filename newname t nil) |
| 3900 | (delete-file filename 'force)))) | 3901 | (delete-file filename)))) |
| 3901 | 3902 | ||
| 3902 | (defun ange-ftp-rename-local-to-remote (filename newname) | 3903 | (defun ange-ftp-rename-local-to-remote (filename newname) |
| 3903 | "Rename local file FILENAME to remote file NEWNAME." | 3904 | "Rename local file FILENAME to remote file NEWNAME." |
| @@ -3906,7 +3907,7 @@ E.g., | |||
| 3906 | (msg (format "Renaming %s to %s" fabbr nabbr))) | 3907 | (msg (format "Renaming %s to %s" fabbr nabbr))) |
| 3907 | (ange-ftp-copy-file-internal filename newname t nil msg) | 3908 | (ange-ftp-copy-file-internal filename newname t nil msg) |
| 3908 | (let (ange-ftp-process-verbose) | 3909 | (let (ange-ftp-process-verbose) |
| 3909 | (delete-file filename 'force)))) | 3910 | (delete-file filename)))) |
| 3910 | 3911 | ||
| 3911 | (defun ange-ftp-rename-remote-to-local (filename newname) | 3912 | (defun ange-ftp-rename-remote-to-local (filename newname) |
| 3912 | "Rename remote file FILENAME to local file NEWNAME." | 3913 | "Rename remote file FILENAME to local file NEWNAME." |
| @@ -3915,7 +3916,7 @@ E.g., | |||
| 3915 | (msg (format "Renaming %s to %s" fabbr nabbr))) | 3916 | (msg (format "Renaming %s to %s" fabbr nabbr))) |
| 3916 | (ange-ftp-copy-file-internal filename newname t nil msg) | 3917 | (ange-ftp-copy-file-internal filename newname t nil msg) |
| 3917 | (let (ange-ftp-process-verbose) | 3918 | (let (ange-ftp-process-verbose) |
| 3918 | (delete-file filename 'force)))) | 3919 | (delete-file filename)))) |
| 3919 | 3920 | ||
| 3920 | (defun ange-ftp-rename-file (filename newname &optional ok-if-already-exists) | 3921 | (defun ange-ftp-rename-file (filename newname &optional ok-if-already-exists) |
| 3921 | (interactive "fRename file: \nFRename %s to file: \np") | 3922 | (interactive "fRename file: \nFRename %s to file: \np") |
| @@ -4196,7 +4197,7 @@ directory, so that Emacs will know its current contents." | |||
| 4196 | (if copy | 4197 | (if copy |
| 4197 | (unwind-protect | 4198 | (unwind-protect |
| 4198 | (funcall 'load copy noerror nomessage nosuffix) | 4199 | (funcall 'load copy noerror nomessage nosuffix) |
| 4199 | (delete-file copy 'force)) | 4200 | (delete-file copy)) |
| 4200 | (or noerror | 4201 | (or noerror |
| 4201 | (signal 'file-error (list "Cannot open load file" file))) | 4202 | (signal 'file-error (list "Cannot open load file" file))) |
| 4202 | nil)) | 4203 | nil)) |
| @@ -4267,7 +4268,7 @@ NEWNAME should be the name to give the new compressed or uncompressed file.") | |||
| 4267 | (if (zerop (buffer-size)) | 4268 | (if (zerop (buffer-size)) |
| 4268 | (progn | 4269 | (progn |
| 4269 | (let (ange-ftp-process-verbose) | 4270 | (let (ange-ftp-process-verbose) |
| 4270 | (delete-file file 'force)) | 4271 | (delete-file file)) |
| 4271 | (ange-ftp-copy-file-internal tmp2 nfile t nil msg2)))) | 4272 | (ange-ftp-copy-file-internal tmp2 nfile t nil msg2)))) |
| 4272 | (ange-ftp-del-tmp-name tmp1) | 4273 | (ange-ftp-del-tmp-name tmp1) |
| 4273 | (ange-ftp-del-tmp-name tmp2)))) | 4274 | (ange-ftp-del-tmp-name tmp2)))) |
| @@ -4303,7 +4304,7 @@ NEWNAME should be the name to give the new compressed or uncompressed file.") | |||
| 4303 | (if (zerop (buffer-size)) | 4304 | (if (zerop (buffer-size)) |
| 4304 | (progn | 4305 | (progn |
| 4305 | (let (ange-ftp-process-verbose) | 4306 | (let (ange-ftp-process-verbose) |
| 4306 | (delete-file file 'force)) | 4307 | (delete-file file)) |
| 4307 | (ange-ftp-copy-file-internal tmp2 nfile t nil msg2)))) | 4308 | (ange-ftp-copy-file-internal tmp2 nfile t nil msg2)))) |
| 4308 | (ange-ftp-del-tmp-name tmp1) | 4309 | (ange-ftp-del-tmp-name tmp1) |
| 4309 | (ange-ftp-del-tmp-name tmp2)))) | 4310 | (ange-ftp-del-tmp-name tmp2)))) |
diff --git a/lisp/net/tramp-compat.el b/lisp/net/tramp-compat.el index a9c4a478c06..530a8693490 100644 --- a/lisp/net/tramp-compat.el +++ b/lisp/net/tramp-compat.el | |||
| @@ -334,23 +334,18 @@ Add the extension of FILENAME, if existing." | |||
| 334 | (if keep-time | 334 | (if keep-time |
| 335 | (set-file-times newname (nth 5 (file-attributes directory)))))))) | 335 | (set-file-times newname (nth 5 (file-attributes directory)))))))) |
| 336 | 336 | ||
| 337 | ;; FORCE has been introduced with Emacs 24.1. | 337 | ;; TRASH has been introduced with Emacs 24.1. |
| 338 | (defun tramp-compat-delete-file (filename &optional force) | 338 | (defun tramp-compat-delete-file (filename &optional trash) |
| 339 | "Like `delete-file' for Tramp files (compat function)." | 339 | "Like `delete-file' for Tramp files (compat function)." |
| 340 | (if (null force) | 340 | (condition-case nil |
| 341 | (delete-file filename) | 341 | (tramp-compat-funcall 'delete-file filename trash) |
| 342 | (condition-case nil | 342 | ;; This Emacs version does not support the TRASH flag. |
| 343 | (tramp-compat-funcall 'delete-file filename force) | 343 | (wrong-number-of-arguments |
| 344 | ;; This Emacs version does not support the FORCE flag. Setting | 344 | (let ((delete-by-moving-to-trash |
| 345 | ;; `delete-by-moving-to-trash' shall give us the same effect. | 345 | (and (boundp 'delete-by-moving-to-trash) |
| 346 | (wrong-number-of-arguments | 346 | delete-by-moving-to-trash |
| 347 | (let ((delete-by-moving-to-trash | 347 | trash))) |
| 348 | (cond | 348 | (delete-file filename))))) |
| 349 | ((null force) t) | ||
| 350 | ((boundp 'delete-by-moving-to-trash) | ||
| 351 | (symbol-value 'delete-by-moving-to-trash)) | ||
| 352 | (t nil)))) | ||
| 353 | (delete-file filename)))))) | ||
| 354 | 349 | ||
| 355 | ;; RECURSIVE has been introduced with Emacs 23.2. | 350 | ;; RECURSIVE has been introduced with Emacs 23.2. |
| 356 | (defun tramp-compat-delete-directory (directory &optional recursive) | 351 | (defun tramp-compat-delete-directory (directory &optional recursive) |
diff --git a/lisp/net/tramp-fish.el b/lisp/net/tramp-fish.el index c7617252288..db5c8ad0b48 100644 --- a/lisp/net/tramp-fish.el +++ b/lisp/net/tramp-fish.el | |||
| @@ -326,16 +326,16 @@ pass to the OPERATION." | |||
| 326 | (lambda (file) | 326 | (lambda (file) |
| 327 | (if (file-directory-p file) | 327 | (if (file-directory-p file) |
| 328 | (tramp-compat-delete-directory file recursive) | 328 | (tramp-compat-delete-directory file recursive) |
| 329 | (delete-file file))) | 329 | (tramp-compat-delete-file file))) |
| 330 | ;; We do not want to delete "." and "..". | 330 | ;; We do not want to delete "." and "..". |
| 331 | (directory-files | 331 | (directory-files |
| 332 | directory 'full "^\\([^.]\\|\\.\\([^.]\\|\\..\\)\\).*"))) | 332 | directory 'full "^\\([^.]\\|\\.\\([^.]\\|\\..\\)\\).*"))) |
| 333 | (with-parsed-tramp-file-name | 333 | (with-parsed-tramp-file-name |
| 334 | (directory-file-name (expand-file-name directory)) nil | 334 | (directory-file-name (expand-file-name directory)) nil |
| 335 | (tramp-flush-directory-property v localname) | 335 | (tramp-flush-directory-property v localname) |
| 336 | (tramp-fish-send-command-and-check v (format "#RMD %s" localname))))) | 336 | (tramp-fish-send-command-and-check v (format "#RMD %s" localname))))) |
| 337 | 337 | ||
| 338 | (defun tramp-fish-handle-delete-file (filename &optional force) | 338 | (defun tramp-fish-handle-delete-file (filename &optional trash) |
| 339 | "Like `delete-file' for Tramp files." | 339 | "Like `delete-file' for Tramp files." |
| 340 | (when (file-exists-p filename) | 340 | (when (file-exists-p filename) |
| 341 | (with-parsed-tramp-file-name (expand-file-name filename) nil | 341 | (with-parsed-tramp-file-name (expand-file-name filename) nil |
| @@ -660,7 +660,7 @@ target of the symlink differ." | |||
| 660 | localname))))) | 660 | localname))))) |
| 661 | (tramp-error | 661 | (tramp-error |
| 662 | v 'file-already-exists "File %s already exists" localname) | 662 | v 'file-already-exists "File %s already exists" localname) |
| 663 | (tramp-compat-delete-file linkname 'force))) | 663 | (tramp-compat-delete-file linkname))) |
| 664 | 664 | ||
| 665 | ;; If FILENAME is a Tramp name, use just the localname component. | 665 | ;; If FILENAME is a Tramp name, use just the localname component. |
| 666 | (when (tramp-tramp-file-p filename) | 666 | (when (tramp-tramp-file-p filename) |
| @@ -839,8 +839,8 @@ target of the symlink differ." | |||
| 839 | ;; Provide error file. | 839 | ;; Provide error file. |
| 840 | (when tmpstderr (rename-file tmpstderr (cadr destination) t)) | 840 | (when tmpstderr (rename-file tmpstderr (cadr destination) t)) |
| 841 | ;; Cleanup. | 841 | ;; Cleanup. |
| 842 | (when tmpinput (tramp-compat-delete-file tmpinput 'force)) | 842 | (when tmpinput (tramp-compat-delete-file tmpinput)) |
| 843 | (when tmpoutput (tramp-compat-delete-file tmpoutput 'force)) | 843 | (when tmpoutput (tramp-compat-delete-file tmpoutput)) |
| 844 | ;; Return exit status. | 844 | ;; Return exit status. |
| 845 | ret))) | 845 | ret))) |
| 846 | 846 | ||
diff --git a/lisp/net/tramp-ftp.el b/lisp/net/tramp-ftp.el index 17cd6216c78..ca421cbaaa6 100644 --- a/lisp/net/tramp-ftp.el +++ b/lisp/net/tramp-ftp.el | |||
| @@ -182,7 +182,7 @@ pass to the OPERATION." | |||
| 182 | (unwind-protect | 182 | (unwind-protect |
| 183 | (rename-file tmpfile newname (car args)) | 183 | (rename-file tmpfile newname (car args)) |
| 184 | ;; Cleanup. | 184 | ;; Cleanup. |
| 185 | (ignore-errors (tramp-compat-delete-file tmpfile 'force))))) | 185 | (ignore-errors (tramp-compat-delete-file tmpfile))))) |
| 186 | 186 | ||
| 187 | ;; Normally, the handlers must be discarded. | 187 | ;; Normally, the handlers must be discarded. |
| 188 | ;; `inhibit-file-name-handlers' isn't sufficient, because the | 188 | ;; `inhibit-file-name-handlers' isn't sufficient, because the |
diff --git a/lisp/net/tramp-gvfs.el b/lisp/net/tramp-gvfs.el index 2cad20e4cfb..25dae77544d 100644 --- a/lisp/net/tramp-gvfs.el +++ b/lisp/net/tramp-gvfs.el | |||
| @@ -533,9 +533,9 @@ is no information where to trace the message.") | |||
| 533 | (tramp-compat-delete-directory | 533 | (tramp-compat-delete-directory |
| 534 | (tramp-gvfs-fuse-file-name directory) recursive)) | 534 | (tramp-gvfs-fuse-file-name directory) recursive)) |
| 535 | 535 | ||
| 536 | (defun tramp-gvfs-handle-delete-file (filename &optional force) | 536 | (defun tramp-gvfs-handle-delete-file (filename &optional tramp) |
| 537 | "Like `delete-file' for Tramp files." | 537 | "Like `delete-file' for Tramp files." |
| 538 | (tramp-compat-delete-file (tramp-gvfs-fuse-file-name filename) force)) | 538 | (tramp-compat-delete-file (tramp-gvfs-fuse-file-name filename) tramp)) |
| 539 | 539 | ||
| 540 | (defun tramp-gvfs-handle-directory-files | 540 | (defun tramp-gvfs-handle-directory-files |
| 541 | (directory &optional full match nosort) | 541 | (directory &optional full match nosort) |
| @@ -742,7 +742,7 @@ is no information where to trace the message.") | |||
| 742 | "gvfs-save" tmpfile (tramp-get-buffer v) nil | 742 | "gvfs-save" tmpfile (tramp-get-buffer v) nil |
| 743 | (tramp-gvfs-url-file-name filename))) | 743 | (tramp-gvfs-url-file-name filename))) |
| 744 | (signal (car err) (cdr err))) | 744 | (signal (car err) (cdr err))) |
| 745 | (tramp-compat-delete-file tmpfile 'force))))) | 745 | (tramp-compat-delete-file tmpfile))))) |
| 746 | 746 | ||
| 747 | ;; Set file modification time. | 747 | ;; Set file modification time. |
| 748 | (when (or (eq visit t) (stringp visit)) | 748 | (when (or (eq visit t) (stringp visit)) |
diff --git a/lisp/net/tramp-imap.el b/lisp/net/tramp-imap.el index e1e91365792..de8e58e7491 100644 --- a/lisp/net/tramp-imap.el +++ b/lisp/net/tramp-imap.el | |||
| @@ -268,7 +268,7 @@ of `copy' and `rename'." | |||
| 268 | (write-region (point-min) (point-max) newname))))) | 268 | (write-region (point-min) (point-max) newname))))) |
| 269 | 269 | ||
| 270 | (when (eq op 'rename) | 270 | (when (eq op 'rename) |
| 271 | (tramp-compat-delete-file filename 'force)))) | 271 | (tramp-compat-delete-file filename)))) |
| 272 | 272 | ||
| 273 | ;; TODO: revise this much | 273 | ;; TODO: revise this much |
| 274 | (defun tramp-imap-handle-expand-file-name (name &optional dir) | 274 | (defun tramp-imap-handle-expand-file-name (name &optional dir) |
| @@ -552,7 +552,7 @@ SIZE MODE WEIRD INODE DEVICE)." | |||
| 552 | ;; (file-exists-p (file-name-directory filename))) | 552 | ;; (file-exists-p (file-name-directory filename))) |
| 553 | (file-directory-p (file-name-directory filename))) | 553 | (file-directory-p (file-name-directory filename))) |
| 554 | 554 | ||
| 555 | (defun tramp-imap-handle-delete-file (filename &optional force) | 555 | (defun tramp-imap-handle-delete-file (filename &optional trash) |
| 556 | "Like `delete-file' for Tramp files." | 556 | "Like `delete-file' for Tramp files." |
| 557 | (cond | 557 | (cond |
| 558 | ((not (file-exists-p filename)) nil) | 558 | ((not (file-exists-p filename)) nil) |
diff --git a/lisp/net/tramp-smb.el b/lisp/net/tramp-smb.el index 00b282b83e3..54cccb49053 100644 --- a/lisp/net/tramp-smb.el +++ b/lisp/net/tramp-smb.el | |||
| @@ -345,7 +345,7 @@ PRESERVE-UID-GID is completely ignored." | |||
| 345 | (condition-case err | 345 | (condition-case err |
| 346 | (rename-file tmpfile newname ok-if-already-exists) | 346 | (rename-file tmpfile newname ok-if-already-exists) |
| 347 | ((error quit) | 347 | ((error quit) |
| 348 | (tramp-compat-delete-file tmpfile 'force) | 348 | (tramp-compat-delete-file tmpfile) |
| 349 | (signal (car err) (cdr err)))) | 349 | (signal (car err) (cdr err)))) |
| 350 | 350 | ||
| 351 | ;; Remote newname. | 351 | ;; Remote newname. |
| @@ -382,7 +382,7 @@ PRESERVE-UID-GID is completely ignored." | |||
| 382 | (lambda (file) | 382 | (lambda (file) |
| 383 | (if (file-directory-p file) | 383 | (if (file-directory-p file) |
| 384 | (tramp-compat-delete-directory file recursive) | 384 | (tramp-compat-delete-directory file recursive) |
| 385 | (delete-file file))) | 385 | (tramp-compat-delete-file file t))) |
| 386 | ;; We do not want to delete "." and "..". | 386 | ;; We do not want to delete "." and "..". |
| 387 | (directory-files | 387 | (directory-files |
| 388 | directory 'full "^\\([^.]\\|\\.\\([^.]\\|\\..\\)\\).*"))) | 388 | directory 'full "^\\([^.]\\|\\.\\([^.]\\|\\..\\)\\).*"))) |
| @@ -404,7 +404,7 @@ PRESERVE-UID-GID is completely ignored." | |||
| 404 | (tramp-error | 404 | (tramp-error |
| 405 | v 'file-error "%s `%s'" (match-string 0) directory)))))) | 405 | v 'file-error "%s `%s'" (match-string 0) directory)))))) |
| 406 | 406 | ||
| 407 | (defun tramp-smb-handle-delete-file (filename &optional force) | 407 | (defun tramp-smb-handle-delete-file (filename &optional trash) |
| 408 | "Like `delete-file' for Tramp files." | 408 | "Like `delete-file' for Tramp files." |
| 409 | (setq filename (expand-file-name filename)) | 409 | (setq filename (expand-file-name filename)) |
| 410 | (when (file-exists-p filename) | 410 | (when (file-exists-p filename) |
| @@ -611,7 +611,7 @@ PRESERVE-UID-GID is completely ignored." | |||
| 611 | v (format "get \"%s\" \"%s\"" | 611 | v (format "get \"%s\" \"%s\"" |
| 612 | (tramp-smb-get-localname v) tmpfile)) | 612 | (tramp-smb-get-localname v) tmpfile)) |
| 613 | ;; Oops, an error. We shall cleanup. | 613 | ;; Oops, an error. We shall cleanup. |
| 614 | (tramp-compat-delete-file tmpfile 'force) | 614 | (tramp-compat-delete-file tmpfile) |
| 615 | (tramp-error | 615 | (tramp-error |
| 616 | v 'file-error "Cannot make local copy of file `%s'" filename))) | 616 | v 'file-error "Cannot make local copy of file `%s'" filename))) |
| 617 | tmpfile))) | 617 | tmpfile))) |
| @@ -861,7 +861,7 @@ target of the symlink differ." | |||
| 861 | (condition-case err | 861 | (condition-case err |
| 862 | (rename-file tmpfile newname ok-if-already-exists) | 862 | (rename-file tmpfile newname ok-if-already-exists) |
| 863 | ((error quit) | 863 | ((error quit) |
| 864 | (tramp-compat-delete-file tmpfile 'force) | 864 | (tramp-compat-delete-file tmpfile) |
| 865 | (signal (car err) (cdr err)))) | 865 | (signal (car err) (cdr err)))) |
| 866 | 866 | ||
| 867 | ;; Remote newname. | 867 | ;; Remote newname. |
| @@ -882,7 +882,7 @@ target of the symlink differ." | |||
| 882 | filename (tramp-smb-get-localname v))) | 882 | filename (tramp-smb-get-localname v))) |
| 883 | (tramp-error v 'file-error "Cannot rename `%s'" filename))))) | 883 | (tramp-error v 'file-error "Cannot rename `%s'" filename))))) |
| 884 | 884 | ||
| 885 | (tramp-compat-delete-file filename 'force))) | 885 | (tramp-compat-delete-file filename))) |
| 886 | 886 | ||
| 887 | (defun tramp-smb-handle-set-file-modes (filename mode) | 887 | (defun tramp-smb-handle-set-file-modes (filename mode) |
| 888 | "Like `set-file-modes' for Tramp files." | 888 | "Like `set-file-modes' for Tramp files." |
| @@ -946,7 +946,7 @@ errors for shares like \"C$/\", which are common in Microsoft Windows." | |||
| 946 | v (format "put %s \"%s\"" | 946 | v (format "put %s \"%s\"" |
| 947 | tmpfile (tramp-smb-get-localname v))) | 947 | tmpfile (tramp-smb-get-localname v))) |
| 948 | (tramp-error v 'file-error "Cannot write `%s'" filename)) | 948 | (tramp-error v 'file-error "Cannot write `%s'" filename)) |
| 949 | (tramp-compat-delete-file tmpfile 'force))) | 949 | (tramp-compat-delete-file tmpfile))) |
| 950 | 950 | ||
| 951 | (unless (equal curbuf (current-buffer)) | 951 | (unless (equal curbuf (current-buffer)) |
| 952 | (tramp-error | 952 | (tramp-error |
diff --git a/lisp/net/tramp.el b/lisp/net/tramp.el index 91b35481730..a1aed599ae9 100644 --- a/lisp/net/tramp.el +++ b/lisp/net/tramp.el | |||
| @@ -2544,7 +2544,7 @@ target of the symlink differ." | |||
| 2544 | l-localname))))) | 2544 | l-localname))))) |
| 2545 | (tramp-error | 2545 | (tramp-error |
| 2546 | l 'file-already-exists "File %s already exists" l-localname) | 2546 | l 'file-already-exists "File %s already exists" l-localname) |
| 2547 | (tramp-compat-delete-file linkname 'force))) | 2547 | (tramp-compat-delete-file linkname))) |
| 2548 | 2548 | ||
| 2549 | ;; If FILENAME is a Tramp name, use just the localname component. | 2549 | ;; If FILENAME is a Tramp name, use just the localname component. |
| 2550 | (when (tramp-tramp-file-p filename) | 2550 | (when (tramp-tramp-file-p filename) |
| @@ -2593,7 +2593,7 @@ target of the symlink differ." | |||
| 2593 | ;; MUST-SUFFIX doesn't exist on XEmacs, so let it default to nil. | 2593 | ;; MUST-SUFFIX doesn't exist on XEmacs, so let it default to nil. |
| 2594 | (unwind-protect | 2594 | (unwind-protect |
| 2595 | (load local-copy noerror t t) | 2595 | (load local-copy noerror t t) |
| 2596 | (tramp-compat-delete-file local-copy 'force))))) | 2596 | (tramp-compat-delete-file local-copy))))) |
| 2597 | t))) | 2597 | t))) |
| 2598 | 2598 | ||
| 2599 | ;; Localname manipulation functions that grok Tramp localnames... | 2599 | ;; Localname manipulation functions that grok Tramp localnames... |
| @@ -3769,7 +3769,7 @@ KEEP-DATE is non-nil if NEWNAME should have the same timestamp as FILENAME." | |||
| 3769 | ;; Set the mode. | 3769 | ;; Set the mode. |
| 3770 | (set-file-modes newname (tramp-default-file-modes filename)) | 3770 | (set-file-modes newname (tramp-default-file-modes filename)) |
| 3771 | ;; If the operation was `rename', delete the original file. | 3771 | ;; If the operation was `rename', delete the original file. |
| 3772 | (unless (eq op 'copy) (tramp-compat-delete-file filename 'force))) | 3772 | (unless (eq op 'copy) (tramp-compat-delete-file filename))) |
| 3773 | 3773 | ||
| 3774 | (defun tramp-do-copy-or-rename-file-directly | 3774 | (defun tramp-do-copy-or-rename-file-directly |
| 3775 | (op filename newname ok-if-already-exists keep-date preserve-uid-gid) | 3775 | (op filename newname ok-if-already-exists keep-date preserve-uid-gid) |
| @@ -3924,7 +3924,7 @@ the uid and gid from FILENAME." | |||
| 3924 | 3924 | ||
| 3925 | ;; Save exit. | 3925 | ;; Save exit. |
| 3926 | (condition-case nil | 3926 | (condition-case nil |
| 3927 | (tramp-compat-delete-file tmpfile 'force) | 3927 | (tramp-compat-delete-file tmpfile) |
| 3928 | (error))))))))) | 3928 | (error))))))))) |
| 3929 | 3929 | ||
| 3930 | ;; Set the time and mode. Mask possible errors. | 3930 | ;; Set the time and mode. Mask possible errors. |
| @@ -3964,7 +3964,7 @@ The method used must be an out-of-band method." | |||
| 3964 | (if dir-flag | 3964 | (if dir-flag |
| 3965 | (tramp-compat-delete-directory | 3965 | (tramp-compat-delete-directory |
| 3966 | (expand-file-name ".." tmpfile) 'recursive) | 3966 | (expand-file-name ".." tmpfile) 'recursive) |
| 3967 | (tramp-compat-delete-file tmpfile 'force)) | 3967 | (tramp-compat-delete-file tmpfile)) |
| 3968 | (error)))) | 3968 | (error)))) |
| 3969 | 3969 | ||
| 3970 | ;; Expand hops. Might be necessary for gateway methods. | 3970 | ;; Expand hops. Might be necessary for gateway methods. |
| @@ -4082,7 +4082,7 @@ The method used must be an out-of-band method." | |||
| 4082 | ;; If the operation was `rename', delete the original file. | 4082 | ;; If the operation was `rename', delete the original file. |
| 4083 | (unless (eq op 'copy) | 4083 | (unless (eq op 'copy) |
| 4084 | (if (file-regular-p filename) | 4084 | (if (file-regular-p filename) |
| 4085 | (tramp-compat-delete-file filename 'force) | 4085 | (tramp-compat-delete-file filename) |
| 4086 | (tramp-compat-delete-directory filename 'recursive)))))) | 4086 | (tramp-compat-delete-directory filename 'recursive)))))) |
| 4087 | 4087 | ||
| 4088 | (defun tramp-handle-make-directory (dir &optional parents) | 4088 | (defun tramp-handle-make-directory (dir &optional parents) |
| @@ -4112,7 +4112,7 @@ The method used must be an out-of-band method." | |||
| 4112 | (tramp-shell-quote-argument localname)))) | 4112 | (tramp-shell-quote-argument localname)))) |
| 4113 | (tramp-error v 'file-error "Couldn't delete %s" directory)))) | 4113 | (tramp-error v 'file-error "Couldn't delete %s" directory)))) |
| 4114 | 4114 | ||
| 4115 | (defun tramp-handle-delete-file (filename &optional force) | 4115 | (defun tramp-handle-delete-file (filename &optional trash) |
| 4116 | "Like `delete-file' for Tramp files." | 4116 | "Like `delete-file' for Tramp files." |
| 4117 | (setq filename (expand-file-name filename)) | 4117 | (setq filename (expand-file-name filename)) |
| 4118 | (with-parsed-tramp-file-name filename nil | 4118 | (with-parsed-tramp-file-name filename nil |
| @@ -4629,7 +4629,7 @@ beginning of local filename are not substituted." | |||
| 4629 | 4629 | ||
| 4630 | ;; Cleanup. We remove all file cache values for the connection, | 4630 | ;; Cleanup. We remove all file cache values for the connection, |
| 4631 | ;; because the remote process could have changed them. | 4631 | ;; because the remote process could have changed them. |
| 4632 | (when tmpinput (tramp-compat-delete-file tmpinput 'force)) | 4632 | (when tmpinput (tramp-compat-delete-file tmpinput)) |
| 4633 | 4633 | ||
| 4634 | ;; `process-file-side-effects' has been introduced with GNU | 4634 | ;; `process-file-side-effects' has been introduced with GNU |
| 4635 | ;; Emacs 23.2. If set to `nil', no remote file will be changed | 4635 | ;; Emacs 23.2. If set to `nil', no remote file will be changed |
| @@ -4666,7 +4666,7 @@ Lisp error raised when PROGRAM is nil is trapped also, returning 1." | |||
| 4666 | (when delete (delete-region start end)) | 4666 | (when delete (delete-region start end)) |
| 4667 | (unwind-protect | 4667 | (unwind-protect |
| 4668 | (apply 'call-process program tmpfile buffer display args) | 4668 | (apply 'call-process program tmpfile buffer display args) |
| 4669 | (tramp-compat-delete-file tmpfile 'force)))) | 4669 | (tramp-compat-delete-file tmpfile)))) |
| 4670 | 4670 | ||
| 4671 | (defun tramp-handle-shell-command | 4671 | (defun tramp-handle-shell-command |
| 4672 | (command &optional output-buffer error-buffer) | 4672 | (command &optional output-buffer error-buffer) |
| @@ -4731,7 +4731,7 @@ Lisp error raised when PROGRAM is nil is trapped also, returning 1." | |||
| 4731 | (when (listp buffer) | 4731 | (when (listp buffer) |
| 4732 | (with-current-buffer error-buffer | 4732 | (with-current-buffer error-buffer |
| 4733 | (insert-file-contents (cadr buffer))) | 4733 | (insert-file-contents (cadr buffer))) |
| 4734 | (tramp-compat-delete-file (cadr buffer) 'force)) | 4734 | (tramp-compat-delete-file (cadr buffer))) |
| 4735 | (if current-buffer-p | 4735 | (if current-buffer-p |
| 4736 | ;; This is like exchange-point-and-mark, but doesn't | 4736 | ;; This is like exchange-point-and-mark, but doesn't |
| 4737 | ;; activate the mark. It is cleaner to avoid activation, | 4737 | ;; activate the mark. It is cleaner to avoid activation, |
| @@ -4813,7 +4813,7 @@ Lisp error raised when PROGRAM is nil is trapped also, returning 1." | |||
| 4813 | (unwind-protect | 4813 | (unwind-protect |
| 4814 | (tramp-call-local-coding-command | 4814 | (tramp-call-local-coding-command |
| 4815 | loc-dec tmpfile2 tmpfile) | 4815 | loc-dec tmpfile2 tmpfile) |
| 4816 | (tramp-compat-delete-file tmpfile2 'force))))) | 4816 | (tramp-compat-delete-file tmpfile2))))) |
| 4817 | 4817 | ||
| 4818 | ;; Set proper permissions. | 4818 | ;; Set proper permissions. |
| 4819 | (set-file-modes tmpfile (tramp-default-file-modes filename)) | 4819 | (set-file-modes tmpfile (tramp-default-file-modes filename)) |
| @@ -4826,7 +4826,7 @@ Lisp error raised when PROGRAM is nil is trapped also, returning 1." | |||
| 4826 | 4826 | ||
| 4827 | ;; Error handling. | 4827 | ;; Error handling. |
| 4828 | ((error quit) | 4828 | ((error quit) |
| 4829 | (tramp-compat-delete-file tmpfile 'force) | 4829 | (tramp-compat-delete-file tmpfile) |
| 4830 | (signal (car err) (cdr err)))) | 4830 | (signal (car err) (cdr err)))) |
| 4831 | 4831 | ||
| 4832 | (run-hooks 'tramp-handle-file-local-copy-hook) | 4832 | (run-hooks 'tramp-handle-file-local-copy-hook) |
| @@ -4961,11 +4961,10 @@ coding system might not be determined. This function repairs it." | |||
| 4961 | (set-buffer-modified-p nil)) | 4961 | (set-buffer-modified-p nil)) |
| 4962 | (when (and (stringp local-copy) | 4962 | (when (and (stringp local-copy) |
| 4963 | (or remote-copy (null tramp-temp-buffer-file-name))) | 4963 | (or remote-copy (null tramp-temp-buffer-file-name))) |
| 4964 | (tramp-compat-delete-file local-copy 'force)) | 4964 | (tramp-compat-delete-file local-copy)) |
| 4965 | (when (stringp remote-copy) | 4965 | (when (stringp remote-copy) |
| 4966 | (tramp-compat-delete-file | 4966 | (tramp-compat-delete-file |
| 4967 | (tramp-make-tramp-file-name method user host remote-copy) | 4967 | (tramp-make-tramp-file-name method user host remote-copy)))))) |
| 4968 | 'force))))) | ||
| 4969 | 4968 | ||
| 4970 | ;; Result. | 4969 | ;; Result. |
| 4971 | (list (expand-file-name filename) | 4970 | (list (expand-file-name filename) |
| @@ -5155,7 +5154,7 @@ Returns a file name in `tramp-auto-save-directory' for autosaving this file." | |||
| 5155 | (list start end tmpfile append 'no-message lockname confirm)) | 5154 | (list start end tmpfile append 'no-message lockname confirm)) |
| 5156 | ((error quit) | 5155 | ((error quit) |
| 5157 | (setq tramp-temp-buffer-file-name nil) | 5156 | (setq tramp-temp-buffer-file-name nil) |
| 5158 | (tramp-compat-delete-file tmpfile 'force) | 5157 | (tramp-compat-delete-file tmpfile) |
| 5159 | (signal (car err) (cdr err)))) | 5158 | (signal (car err) (cdr err)))) |
| 5160 | 5159 | ||
| 5161 | ;; Now, `last-coding-system-used' has the right value. Remember it. | 5160 | ;; Now, `last-coding-system-used' has the right value. Remember it. |
| @@ -5199,13 +5198,13 @@ Returns a file name in `tramp-auto-save-directory' for autosaving this file." | |||
| 5199 | (copy-file tmpfile filename t) | 5198 | (copy-file tmpfile filename t) |
| 5200 | ((error quit) | 5199 | ((error quit) |
| 5201 | (setq tramp-temp-buffer-file-name nil) | 5200 | (setq tramp-temp-buffer-file-name nil) |
| 5202 | (tramp-compat-delete-file tmpfile 'force) | 5201 | (tramp-compat-delete-file tmpfile) |
| 5203 | (signal (car err) (cdr err))))) | 5202 | (signal (car err) (cdr err))))) |
| 5204 | (setq tramp-temp-buffer-file-name nil) | 5203 | (setq tramp-temp-buffer-file-name nil) |
| 5205 | ;; Don't rename, in order to keep context in SELinux. | 5204 | ;; Don't rename, in order to keep context in SELinux. |
| 5206 | (unwind-protect | 5205 | (unwind-protect |
| 5207 | (copy-file tmpfile filename t) | 5206 | (copy-file tmpfile filename t) |
| 5208 | (tramp-compat-delete-file tmpfile 'force)))) | 5207 | (tramp-compat-delete-file tmpfile)))) |
| 5209 | 5208 | ||
| 5210 | ;; Use inline file transfer. | 5209 | ;; Use inline file transfer. |
| 5211 | (rem-dec | 5210 | (rem-dec |
| @@ -5290,7 +5289,7 @@ Returns a file name in `tramp-auto-save-directory' for autosaving this file." | |||
| 5290 | filename rem-dec))))) | 5289 | filename rem-dec))))) |
| 5291 | 5290 | ||
| 5292 | ;; Save exit. | 5291 | ;; Save exit. |
| 5293 | (tramp-compat-delete-file tmpfile 'force))) | 5292 | (tramp-compat-delete-file tmpfile))) |
| 5294 | 5293 | ||
| 5295 | ;; That's not expected. | 5294 | ;; That's not expected. |
| 5296 | (t | 5295 | (t |
| @@ -6373,7 +6372,7 @@ hosts, or files, disagree." | |||
| 6373 | "Remove temporary files related to current buffer." | 6372 | "Remove temporary files related to current buffer." |
| 6374 | (when (stringp tramp-temp-buffer-file-name) | 6373 | (when (stringp tramp-temp-buffer-file-name) |
| 6375 | (condition-case nil | 6374 | (condition-case nil |
| 6376 | (tramp-compat-delete-file tramp-temp-buffer-file-name 'force) | 6375 | (tramp-compat-delete-file tramp-temp-buffer-file-name) |
| 6377 | (error nil)))) | 6376 | (error nil)))) |
| 6378 | 6377 | ||
| 6379 | (add-hook 'kill-buffer-hook 'tramp-delete-temp-file-function) | 6378 | (add-hook 'kill-buffer-hook 'tramp-delete-temp-file-function) |
diff --git a/lisp/server.el b/lisp/server.el index 6b5f2486332..fd2026c4ab8 100644 --- a/lisp/server.el +++ b/lisp/server.el | |||
| @@ -345,7 +345,7 @@ If CLIENT is non-nil, add a description of it to the logged message." | |||
| 345 | (and (process-contact proc :server) | 345 | (and (process-contact proc :server) |
| 346 | (eq (process-status proc) 'closed) | 346 | (eq (process-status proc) 'closed) |
| 347 | (ignore-errors | 347 | (ignore-errors |
| 348 | (delete-file (process-get proc :server-file) t))) | 348 | (delete-file (process-get proc :server-file)))) |
| 349 | (server-log (format "Status changed to %s: %s" (process-status proc) msg) proc) | 349 | (server-log (format "Status changed to %s: %s" (process-status proc) msg) proc) |
| 350 | (server-delete-client proc)) | 350 | (server-delete-client proc)) |
| 351 | 351 | ||
diff --git a/lisp/speedbar.el b/lisp/speedbar.el index 60c1ff6b170..5e732b398f3 100644 --- a/lisp/speedbar.el +++ b/lisp/speedbar.el | |||
| @@ -1644,8 +1644,8 @@ Files can be renamed to new names or moved to new directories." | |||
| 1644 | (if (speedbar-y-or-n-p (format "Delete %s? " f) t) | 1644 | (if (speedbar-y-or-n-p (format "Delete %s? " f) t) |
| 1645 | (progn | 1645 | (progn |
| 1646 | (if (file-directory-p f) | 1646 | (if (file-directory-p f) |
| 1647 | (delete-directory f) | 1647 | (delete-directory f t t) |
| 1648 | (delete-file f)) | 1648 | (delete-file f t)) |
| 1649 | (speedbar-message "Okie dokie.") | 1649 | (speedbar-message "Okie dokie.") |
| 1650 | (let ((p (point))) | 1650 | (let ((p (point))) |
| 1651 | (speedbar-refresh) | 1651 | (speedbar-refresh) |
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); |