emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

master 4b15b88e71 2/2: Make `d' in Dired skip dot files


From: Lars Ingebrigtsen
Subject: master 4b15b88e71 2/2: Make `d' in Dired skip dot files
Date: Mon, 23 May 2022 06:19:19 -0400 (EDT)

branch: master
commit 4b15b88e714f39ca6926f17b36a1302959b69643
Author: Lars Ingebrigtsen <larsi@gnus.org>
Commit: Lars Ingebrigtsen <larsi@gnus.org>

    Make `d' in Dired skip dot files
    
    * lisp/dired.el (dired-mark): Skip dot files (bug#38729).  This
    makes `C-u 10 d' (etc) consistent with marking the next ten lines
    with the mouse and then hitting `d'.
---
 etc/NEWS      | 8 ++++++++
 lisp/dired.el | 6 +++++-
 2 files changed, 13 insertions(+), 1 deletion(-)

diff --git a/etc/NEWS b/etc/NEWS
index c146b746cf..032450b6ee 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -136,6 +136,14 @@ of 'user-emacs-directory'.
 
 * Incompatible changes in Emacs 29.1
 
+---
+** The 'd' command in Dired now more consistently skip dot files.
+In previous Emacs versions, commands like `C-u 10 d' would put the "D"
+mark on the next ten files, no matter whether they were dot files
+(i.e., "." and "..") or not, while marking the next ten lines with the
+mouse (in 'transient-mark-mode') and then hitting 'd' would skip dot
+files.  These now work equivalently.
+
 ---
 ** Isearch in "*Help*" and "*info*" now char-folds quote characters by default.
 This means that you can say 'C-s `foo' (GRAVE ACCENT) if the buffer
diff --git a/lisp/dired.el b/lisp/dired.el
index 89fbd52aa6..fbf26dbce7 100644
--- a/lisp/dired.el
+++ b/lisp/dired.el
@@ -3957,7 +3957,11 @@ this subdir."
     (let ((inhibit-read-only t))
       (dired-repeat-over-lines
        (prefix-numeric-value arg)
-       (lambda () (delete-char 1) (insert dired-marker-char)))))))
+       (lambda ()
+         (when (or (not (looking-at-p dired-re-dot))
+                   (not (equal dired-marker-char dired-del-marker)))
+           (delete-char 1)
+           (insert dired-marker-char))))))))
 
 (defun dired-unmark (arg &optional interactive)
   "Unmark the file at point in the Dired buffer.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]