aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStefan Monnier2008-03-26 03:34:07 +0000
committerStefan Monnier2008-03-26 03:34:07 +0000
commit04509548fd053f498ee40769ef9779c5e0cccb0a (patch)
treec75d915ccda5ddea5eba317bfedb1f488446e4a8
parent0ec08b38001ff9e3f8ec59133a70b217330a3763 (diff)
downloademacs-04509548fd053f498ee40769ef9779c5e0cccb0a.tar.gz
emacs-04509548fd053f498ee40769ef9779c5e0cccb0a.zip
(dired-create-files): Use dolist.
-rw-r--r--lisp/ChangeLog2
-rw-r--r--lisp/dired-aux.el79
2 files changed, 40 insertions, 41 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 97e59b46f25..a2c1eb502bf 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,5 +1,7 @@
12008-03-26 Stefan Monnier <monnier@iro.umontreal.ca> 12008-03-26 Stefan Monnier <monnier@iro.umontreal.ca>
2 2
3 * dired-aux.el (dired-create-files): Use dolist.
4
3 * bindings.el (mode-line-change-eol): Use with-selected-window. 5 * bindings.el (mode-line-change-eol): Use with-selected-window.
4 6
5 * apropos.el (apropos-command): Include macros. 7 * apropos.el (apropos-command): Include macros.
diff --git a/lisp/dired-aux.el b/lisp/dired-aux.el
index 11cf1e184d8..5e27d51a3d9 100644
--- a/lisp/dired-aux.el
+++ b/lisp/dired-aux.el
@@ -1389,51 +1389,48 @@ Special value `always' suppresses confirmation."
1389 skipped (success-count 0) (total (length fn-list))) 1389 skipped (success-count 0) (total (length fn-list)))
1390 (let (to overwrite-query 1390 (let (to overwrite-query
1391 overwrite-backup-query) ; for dired-handle-overwrite 1391 overwrite-backup-query) ; for dired-handle-overwrite
1392 (mapc 1392 (dolist (from fn-list)
1393 (function 1393 (setq to (funcall name-constructor from))
1394 (lambda (from) 1394 (if (equal to from)
1395 (setq to (funcall name-constructor from)) 1395 (progn
1396 (if (equal to from) 1396 (setq to nil)
1397 (progn 1397 (dired-log "Cannot %s to same file: %s\n"
1398 (setq to nil) 1398 (downcase operation) from)))
1399 (dired-log "Cannot %s to same file: %s\n" 1399 (if (not to)
1400 (downcase operation) from))) 1400 (setq skipped (cons (dired-make-relative from) skipped))
1401 (if (not to) 1401 (let* ((overwrite (file-exists-p to))
1402 (setq skipped (cons (dired-make-relative from) skipped)) 1402 (dired-overwrite-confirmed ; for dired-handle-overwrite
1403 (let* ((overwrite (file-exists-p to)) 1403 (and overwrite
1404 (dired-overwrite-confirmed ; for dired-handle-overwrite 1404 (let ((help-form '(format "\
1405 (and overwrite
1406 (let ((help-form '(format "\
1407Type SPC or `y' to overwrite file `%s', 1405Type SPC or `y' to overwrite file `%s',
1408DEL or `n' to skip to next, 1406DEL or `n' to skip to next,
1409ESC or `q' to not overwrite any of the remaining files, 1407ESC or `q' to not overwrite any of the remaining files,
1410`!' to overwrite all remaining files with no more questions." to))) 1408`!' to overwrite all remaining files with no more questions." to)))
1411 (dired-query 'overwrite-query 1409 (dired-query 'overwrite-query
1412 "Overwrite `%s'?" to)))) 1410 "Overwrite `%s'?" to))))
1413 ;; must determine if FROM is marked before file-creator 1411 ;; must determine if FROM is marked before file-creator
1414 ;; gets a chance to delete it (in case of a move). 1412 ;; gets a chance to delete it (in case of a move).
1415 (actual-marker-char 1413 (actual-marker-char
1416 (cond ((integerp marker-char) marker-char) 1414 (cond ((integerp marker-char) marker-char)
1417 (marker-char (dired-file-marker from)) ; slow 1415 (marker-char (dired-file-marker from)) ; slow
1418 (t nil)))) 1416 (t nil))))
1419 (condition-case err 1417 (condition-case err
1420 (progn 1418 (progn
1421 (funcall file-creator from to dired-overwrite-confirmed) 1419 (funcall file-creator from to dired-overwrite-confirmed)
1422 (if overwrite 1420 (if overwrite
1423 ;; If we get here, file-creator hasn't been aborted 1421 ;; If we get here, file-creator hasn't been aborted
1424 ;; and the old entry (if any) has to be deleted 1422 ;; and the old entry (if any) has to be deleted
1425 ;; before adding the new entry. 1423 ;; before adding the new entry.
1426 (dired-remove-file to)) 1424 (dired-remove-file to))
1427 (setq success-count (1+ success-count)) 1425 (setq success-count (1+ success-count))
1428 (message "%s: %d of %d" operation success-count total) 1426 (message "%s: %d of %d" operation success-count total)
1429 (dired-add-file to actual-marker-char)) 1427 (dired-add-file to actual-marker-char))
1430 (file-error ; FILE-CREATOR aborted 1428 (file-error ; FILE-CREATOR aborted
1431 (progn 1429 (progn
1432 (push (dired-make-relative from) 1430 (push (dired-make-relative from)
1433 failures) 1431 failures)
1434 (dired-log "%s `%s' to `%s' failed:\n%s\n" 1432 (dired-log "%s `%s' to `%s' failed:\n%s\n"
1435 operation from to err)))))))) 1433 operation from to err))))))))
1436 fn-list))
1437 (cond 1434 (cond
1438 (dired-create-files-failures 1435 (dired-create-files-failures
1439 (setq failures (nconc failures dired-create-files-failures)) 1436 (setq failures (nconc failures dired-create-files-failures))