1

Linux Mint 20 Emacs 27

package dired, dired+

In folder Downloads I has: one folder and two files.

I want to delete all content of folder Downloads

So as result on Dired mode I press t.

Here result:

enter image description here

As you can see marked also dot and double dots. So as result I can't delete all. I press D and get error:

Cannot operate on '.' or '..'

enter image description here

So as result I need MANUAL mark files by press m and only then I can delete all content of folder Downloads enter image description here

So the question is: Is it possible when press t (in dired mode) to not mark dot and double dots?

1 Answer 1

1

With Dired+, try this replacement for command dired-toggle-marks. You can then use C-u to prevent . and .. from toggling. (FYI: toggling them is part of a fix for Emacs bug #48883.)

(defun dired-toggle-marks (&optional except-dot+dot-dot-p)
  "Toggle marks: marked files become unmarked, and vice versa.
Marks (such as `C' and `D') other than `*' are not affected.
Hidden subdirs are also not affected.

By default, this toggles also `.' and `..' (see Emacs bug #48883).
With a prefix arg it does not toggle `.' and `..'."
  (interactive "P")
  (save-excursion
    (goto-char (point-min))
    (let ((inhibit-read-only  t))
      (while (not (eobp))
        (or (dired-between-files)
            (and except-dot+dot-dot-p
                 (member (dired-get-filename t t) '("." "..")))
            (apply 'subst-char-in-region (point)
                   (1+ (point))
                   (if (eq ?\   (following-char))
                       (list ?\   dired-marker-char)
                     (list dired-marker-char ?\  ))))
        (forward-line 1)))))

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.