aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChong Yidong2011-03-19 18:07:41 -0400
committerChong Yidong2011-03-19 18:07:41 -0400
commitff854b0bde465a9db550dcff21d8db411c84818d (patch)
tree3f2751fca011ec303cadf33f047784aa21446522
parentfe0fb33e832ea83ffe8cab449eb41ed4acb691d9 (diff)
downloademacs-ff854b0bde465a9db550dcff21d8db411c84818d.tar.gz
emacs-ff854b0bde465a9db550dcff21d8db411c84818d.zip
Add error for dired-create-directory on existing file (Bug#8246).
* lisp/dired-aux.el (dired-create-directory): Signal an error if the directory already exists.
-rw-r--r--lisp/ChangeLog3
-rw-r--r--lisp/dired-aux.el5
-rw-r--r--lisp/dired.el3
3 files changed, 9 insertions, 2 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 5244e261c11..a60ce0be672 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,5 +1,8 @@
12011-03-19 Chong Yidong <cyd@stupidchicken.com> 12011-03-19 Chong Yidong <cyd@stupidchicken.com>
2 2
3 * dired-aux.el (dired-create-directory): Signal an error if the
4 directory already exists (Bug#8246).
5
3 * facemenu.el (list-colors-display): Call list-faces-display 6 * facemenu.el (list-colors-display): Call list-faces-display
4 inside with-help-window. 7 inside with-help-window.
5 (list-colors-print): Use display property to align the final 8 (list-colors-print): Use display property to align the final
diff --git a/lisp/dired-aux.el b/lisp/dired-aux.el
index c533c81be0e..9ab1fcb0e2b 100644
--- a/lisp/dired-aux.el
+++ b/lisp/dired-aux.el
@@ -1638,11 +1638,14 @@ Optional arg HOW-TO determiness how to treat the target.
1638 1638
1639;;;###autoload 1639;;;###autoload
1640(defun dired-create-directory (directory) 1640(defun dired-create-directory (directory)
1641 "Create a directory called DIRECTORY." 1641 "Create a directory called DIRECTORY.
1642If DIRECTORY already exists, signal an error."
1642 (interactive 1643 (interactive
1643 (list (read-file-name "Create directory: " (dired-current-directory)))) 1644 (list (read-file-name "Create directory: " (dired-current-directory))))
1644 (let* ((expanded (directory-file-name (expand-file-name directory))) 1645 (let* ((expanded (directory-file-name (expand-file-name directory)))
1645 (try expanded) new) 1646 (try expanded) new)
1647 (if (file-exists-p expanded)
1648 (error "Cannot create directory %s: file exists" expanded))
1646 ;; Find the topmost nonexistent parent dir (variable `new') 1649 ;; Find the topmost nonexistent parent dir (variable `new')
1647 (while (and try (not (file-exists-p try)) (not (equal new try))) 1650 (while (and try (not (file-exists-p try)) (not (equal new try)))
1648 (setq new try 1651 (setq new try
diff --git a/lisp/dired.el b/lisp/dired.el
index c4374503a6f..22470ea61e6 100644
--- a/lisp/dired.el
+++ b/lisp/dired.el
@@ -3627,7 +3627,7 @@ Ask means pop up a menu for the user to select one of copy, move or link."
3627;;;;;; dired-run-shell-command dired-do-shell-command dired-do-async-shell-command 3627;;;;;; dired-run-shell-command dired-do-shell-command dired-do-async-shell-command
3628;;;;;; dired-clean-directory dired-do-print dired-do-touch dired-do-chown 3628;;;;;; dired-clean-directory dired-do-print dired-do-touch dired-do-chown
3629;;;;;; dired-do-chgrp dired-do-chmod dired-compare-directories dired-backup-diff 3629;;;;;; dired-do-chgrp dired-do-chmod dired-compare-directories dired-backup-diff
3630;;;;;; dired-diff) "dired-aux" "dired-aux.el" "154cdfbf451aedec60c5012b625ff329") 3630;;;;;; dired-diff) "dired-aux" "dired-aux.el" "2d805d6766bd7970cd446413b4ed4ce0")
3631;;; Generated autoloads from dired-aux.el 3631;;; Generated autoloads from dired-aux.el
3632 3632
3633(autoload 'dired-diff "dired-aux" "\ 3633(autoload 'dired-diff "dired-aux" "\
@@ -3858,6 +3858,7 @@ Not documented
3858 3858
3859(autoload 'dired-create-directory "dired-aux" "\ 3859(autoload 'dired-create-directory "dired-aux" "\
3860Create a directory called DIRECTORY. 3860Create a directory called DIRECTORY.
3861If DIRECTORY already exists, signal an error.
3861 3862
3862\(fn DIRECTORY)" t nil) 3863\(fn DIRECTORY)" t nil)
3863 3864