all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* PR: dired-do-create-files now checks for trailing slashes in the target
@ 2021-09-28 17:50 Rudi C
  2021-09-28 18:17 ` Stefan Kangas
  0 siblings, 1 reply; 55+ messages in thread
From: Rudi C @ 2021-09-28 17:50 UTC (permalink / raw)
  To: emacs-devel


[-- Attachment #1.1: Type: text/plain, Size: 503 bytes --]

With this patch, we can move directories into new directories if we
explicitly end the new name with a trailing slash.

So `/new_name` renames `/old_name` to `/new_name`, while `/new_name/`
renames `/old_name` to `/new_name/old_name`.

Without this feature, one has to first create the new directory and then
move the old directory into it, which is so unpleasant I currently just
copy the path and use my shell's move functions.

PS: Please use reply-to-all, I am currently not subscribed to the list.

[-- Attachment #1.2: Type: text/html, Size: 625 bytes --]

[-- Attachment #2: 0001-dired-do-create-files-now-checks-for-trailing-slashe.patch --]
[-- Type: application/octet-stream, Size: 992 bytes --]

From 002984ab26573ce560a4dd7ec3f9a9aab600abbf Mon Sep 17 00:00:00 2001
From: NightMachinary <rudiwillalwaysloveyou@gmail.com>
Date: Tue, 28 Sep 2021 21:14:05 +0330
Subject: [PATCH] dired-do-create-files now checks for trailing slashes in the
 target

---
 lisp/dired-aux.el | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/lisp/dired-aux.el b/lisp/dired-aux.el
index 397c5c67cb..72cee2c485 100644
--- a/lisp/dired-aux.el
+++ b/lisp/dired-aux.el
@@ -2157,7 +2157,9 @@ Optional arg HOW-TO determines how to treat the target.
 		     target-dir op-symbol arg rfn-list default))))
 	 (into-dir
           (progn
-            (unless dired-one-file (dired-maybe-create-dirs target))
+            (when (or (not dired-one-file)
+                      (string= (substring target -1) "/"))
+              (dired-maybe-create-dirs target))
             (cond ((null how-to)
 		   ;; Allow users to change the letter case of
 		   ;; a directory on a case-insensitive
-- 
2.32.0


^ permalink raw reply related	[flat|nested] 55+ messages in thread

end of thread, other threads:[~2021-12-06  6:01 UTC | newest]

Thread overview: 55+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-09-28 17:50 PR: dired-do-create-files now checks for trailing slashes in the target Rudi C
2021-09-28 18:17 ` Stefan Kangas
2021-09-28 18:42   ` Rudi C
2021-09-28 19:03     ` Stefan Kangas
2021-09-28 19:38       ` Tassilo Horn
2021-09-28 20:07         ` Stefan Kangas
2021-09-28 20:23       ` Rudi C
2021-09-28 18:42   ` Eli Zaretskii
2021-09-28 19:29     ` Tassilo Horn
2021-09-28 19:55       ` Eli Zaretskii
2021-09-29  4:46         ` Tassilo Horn
2021-09-29 13:09           ` Eli Zaretskii
2021-09-29 13:20             ` Rudi C
2021-09-29 13:34               ` Eli Zaretskii
2021-09-29 13:37               ` Tassilo Horn
2021-09-29 13:42               ` Stefan Kangas
2021-09-29 13:53                 ` Tassilo Horn
2021-09-29 14:31                   ` Rudi C
2021-09-29 13:23             ` Tassilo Horn
2021-09-29 13:41               ` Eli Zaretskii
2021-09-29 13:42                 ` Tassilo Horn
2021-09-29 13:57                   ` Eli Zaretskii
2021-09-29 14:21                     ` Lars Ingebrigtsen
2021-09-29 15:04                       ` Stefan Kangas
2021-09-29 15:17                         ` Tassilo Horn
2021-09-30  6:06                           ` Lars Ingebrigtsen
2021-09-30  7:29                             ` Lars Ingebrigtsen
2021-09-30  8:32                             ` Tassilo Horn
2021-09-30 13:33                               ` Lars Ingebrigtsen
2021-09-30 14:10                                 ` Tassilo Horn
2021-09-30 16:03                                   ` Eli Zaretskii
2021-09-30 16:48                                     ` Tassilo Horn
2021-09-30 17:47                                       ` Eli Zaretskii
2021-09-30 18:52                                         ` Rudi C
2021-09-30 19:02                                           ` Eli Zaretskii
2021-11-01 15:37                                         ` Rudi C
2021-11-02 14:44                                           ` Lars Ingebrigtsen
2021-11-02 15:08                                             ` Rudi C
2021-11-02 15:15                                               ` Eli Zaretskii
2021-11-09 12:52                                                 ` Rudi C
2021-11-09 13:47                                                   ` Eli Zaretskii
2021-12-05 12:12                                                   ` Tassilo Horn
2021-12-05 13:26                                                     ` Rudi C
2021-12-05 17:00                                                       ` Tassilo Horn
2021-12-06  4:34                                                       ` Richard Stallman
2021-12-05 20:24                                                     ` Lars Ingebrigtsen
2021-12-06  6:01                                                       ` Tassilo Horn
2021-09-30 15:45                               ` [External] : " Drew Adams
2021-09-30 13:54                             ` Stefan Kangas
2021-09-30 13:59                               ` Lars Ingebrigtsen
2021-09-29 15:44                       ` Eli Zaretskii
2021-09-29 17:01                   ` [External] : " Drew Adams
2021-09-29 19:09                     ` Tassilo Horn
2021-09-29 19:35                       ` Drew Adams
2021-09-29 13:57               ` Stefan Kangas

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.