3

In Dired, you can mark files each for each and do something with it.

I was wondering if there is any way to allow visual selection of files in Dired, so you can mark every line inside the visual region? Then there is no need to mark every file again and again. I found nothing in Emacs communities about this.

3

Start a selection with C-SPC, move point to the end of the selection, then hit m to mark all the lines.

3
  • After remapping the selection key to (evil-define-key 'normal dired-mode-map (kbd "V") 'set-mark-command), in Dired I made a selection and then hitted m. But I got the message Buffer is read-only: #<buffer modules>. Any chance to know what this means?
    – ReneFroger
    Oct 3 '15 at 16:25
  • Buffer modules? Sounds like the command you are invoking has a different buffer current, not the Dired buffer. Sounds like that's your problem. Investigate the command you are actually executing, to see why (you can use M-x debug-on-entry, for example).
    – Drew
    Oct 3 '15 at 16:32
  • I found out it that in visual selection, with hitting m another command was called instead dired-mark. It related to my configuration, and I fixed it. Thanks for your reply, this issue is solved now. :)
    – ReneFroger
    Oct 3 '15 at 16:41
2

Yes, when the region is active, m marks all of the files selected by it. You can then act on the marked files.

But it can often be easier to use the mouse to select the files, and then use it to act on those selected. If you use Dired+ then you can do this. You can do more with the files, besides just marking them. mouse-3 gives you a popup menu for acting on the files.

enter image description here

(If no region is active, then mouse-3 shows a menu for acting on just the file where you clicked mouse-3.)

If you also use library mouse3.el (the code is here) then you can optionally use its popup menu, which is specially adapted for Dired, rather than the simpler menu shown above. Here is a screenshot.

enter image description here

4
  • I found that package too, thanks for your suggestion. But I was wondering how I could activate a selection and mark it, see my response to Wasama's answer.
    – ReneFroger
    Oct 3 '15 at 16:27
  • If you use the Dired+ mouse3 popup menu there should be no problem. If you use m, likewise, except that from your comment to @wasamasa it sounds like m is bound to a different command in your Dired buffer -- perhaps due to your use of Evil. You can investigate that command or just bind another key to the usual command for m, dired-mark, and use that.
    – Drew
    Oct 3 '15 at 16:30
  • I found out it that in visual selection, another command was called instead dired-mark. It related to my configuration, and I fixed it. Thanks for your reply.
    – ReneFroger
    Oct 3 '15 at 16:40
  • Since you use Evil, this should from now on be your first reflex in cases like this: check what command is actually being invoked.
    – Drew
    Oct 3 '15 at 17:05

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.