* dired-create-directory with arbitrary depth
@ 2007-11-08 0:45 Juri Linkov
2007-11-08 17:39 ` Richard Stallman
0 siblings, 1 reply; 2+ messages in thread
From: Juri Linkov @ 2007-11-08 0:45 UTC (permalink / raw)
To: emacs-devel
I propose to remove a restriction that `dired-create-directory' can create
only one immediate subdirectory. The patch below keeps the old behavior
for creating an immediate subdirectory but also allows creating
subdirectories with an arbitrary depth. It searches for the topmost
nonexistent parent directory and uses it to add a dired entry. It also
calls `make-directory' with the `parents' arguments to create all parent
directories:
Index: lisp/dired-aux.el
===================================================================
RCS file: /sources/emacs/emacs/lisp/dired-aux.el,v
retrieving revision 1.156
diff -c -r1.156 dired-aux.el
*** lisp/dired-aux.el 25 Sep 2007 10:44:23 -0000 1.156
--- lisp/dired-aux.el 8 Nov 2007 00:44:45 -0000
***************
*** 1528,1537 ****
"Create a directory called DIRECTORY."
(interactive
(list (read-file-name "Create directory: " (dired-current-directory))))
! (let ((expanded (directory-file-name (expand-file-name directory))))
! (make-directory expanded)
! (dired-add-file expanded)
! (dired-move-to-filename)))
(defun dired-into-dir-with-symlinks (target)
(and (file-directory-p target)
--- 1542,1557 ----
"Create a directory called DIRECTORY."
(interactive
(list (read-file-name "Create directory: " (dired-current-directory))))
! (let* ((expanded (directory-file-name (expand-file-name directory)))
! (try expanded) new)
! ;; Find the topmost nonexistent parent dir (variable `new')
! (while (and try (not (file-exists-p try)) (not (equal new try)))
! (setq new try
! try (directory-file-name (file-name-directory try))))
! (make-directory expanded t)
! (when new
! (dired-add-file new)
! (dired-move-to-filename))))
(defun dired-into-dir-with-symlinks (target)
(and (file-directory-p target)
--
Juri Linkov
http://www.jurta.org/emacs/
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: dired-create-directory with arbitrary depth
2007-11-08 0:45 dired-create-directory with arbitrary depth Juri Linkov
@ 2007-11-08 17:39 ` Richard Stallman
0 siblings, 0 replies; 2+ messages in thread
From: Richard Stallman @ 2007-11-08 17:39 UTC (permalink / raw)
To: Juri Linkov; +Cc: emacs-devel
It sounds good.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2007-11-08 17:39 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-11-08 0:45 dired-create-directory with arbitrary depth Juri Linkov
2007-11-08 17:39 ` Richard Stallman
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).