1
0
mirror of https://git.savannah.gnu.org/git/emacs.git synced 2024-12-23 10:34:07 +00:00

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.
This commit is contained in:
Chong Yidong 2011-03-19 18:07:41 -04:00
parent fe0fb33e83
commit ff854b0bde
3 changed files with 9 additions and 2 deletions

View File

@ -1,5 +1,8 @@
2011-03-19 Chong Yidong <cyd@stupidchicken.com>
* dired-aux.el (dired-create-directory): Signal an error if the
directory already exists (Bug#8246).
* facemenu.el (list-colors-display): Call list-faces-display
inside with-help-window.
(list-colors-print): Use display property to align the final

View File

@ -1638,11 +1638,14 @@ Optional arg HOW-TO determiness how to treat the target.
;;;###autoload
(defun dired-create-directory (directory)
"Create a directory called DIRECTORY."
"Create a directory called DIRECTORY.
If DIRECTORY already exists, signal an error."
(interactive
(list (read-file-name "Create directory: " (dired-current-directory))))
(let* ((expanded (directory-file-name (expand-file-name directory)))
(try expanded) new)
(if (file-exists-p expanded)
(error "Cannot create directory %s: file exists" expanded))
;; Find the topmost nonexistent parent dir (variable `new')
(while (and try (not (file-exists-p try)) (not (equal new try)))
(setq new try

View File

@ -3627,7 +3627,7 @@ Ask means pop up a menu for the user to select one of copy, move or link."
;;;;;; dired-run-shell-command dired-do-shell-command dired-do-async-shell-command
;;;;;; dired-clean-directory dired-do-print dired-do-touch dired-do-chown
;;;;;; dired-do-chgrp dired-do-chmod dired-compare-directories dired-backup-diff
;;;;;; dired-diff) "dired-aux" "dired-aux.el" "154cdfbf451aedec60c5012b625ff329")
;;;;;; dired-diff) "dired-aux" "dired-aux.el" "2d805d6766bd7970cd446413b4ed4ce0")
;;; Generated autoloads from dired-aux.el
(autoload 'dired-diff "dired-aux" "\
@ -3858,6 +3858,7 @@ Not documented
(autoload 'dired-create-directory "dired-aux" "\
Create a directory called DIRECTORY.
If DIRECTORY already exists, signal an error.
\(fn DIRECTORY)" t nil)