From: Lars Ingebrigtsen Date: Sat, 24 Sep 2022 13:27:50 +0000 (+0200) Subject: Make dired-do-rename refuse to rename . and .. X-Git-Tag: emacs-29.0.90~1856^2~256 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=2bacd9115f15111a2b229ea21776bab2fd5839b1;p=emacs.git 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. --- 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"))