From 2bacd9115f15111a2b229ea21776bab2fd5839b1 Mon Sep 17 00:00:00 2001 From: Lars Ingebrigtsen Date: Sat, 24 Sep 2022 15:27:50 +0200 Subject: [PATCH] Make dired-do-rename refuse to rename . and .. * lisp/dired-aux.el (dired-do-rename): Refuse to rename . and .. (bug#52004). This used to error out after renaming. --- lisp/dired-aux.el | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lisp/dired-aux.el b/lisp/dired-aux.el index f870494e93e..9add96c2608 100644 --- a/lisp/dired-aux.el +++ b/lisp/dired-aux.el @@ -2880,6 +2880,10 @@ of `dired-dwim-target', which see. Also see `dired-do-revert-buffer'." (interactive "P") + (when (seq-find (lambda (file) + (member (file-name-nondirectory file) '("." ".."))) + (dired-get-marked-files nil arg)) + (user-error "Can't rename \".\" or \"..\" files")) (dired-do-create-files 'move #'dired-rename-file "Move" arg dired-keep-marker-rename "Rename")) -- 2.39.2