12

More often than not, when I open a dired buffer, I press

  • ( to run dired-hide-details-mode

  • s to rundired-sort-toggle-or-edit

What's a good way to have these done automatically every time I open a dired buffer?

2
  • 4
    Use dired-mode-hook. Hooks are the standard way to perform mode-specific customizations.
    – Dan
    Oct 18 '16 at 16:53
  • Thanks @Dan! I've added an answer based on your suggestion.
    – dharmatech
    Oct 18 '16 at 17:02
11

Thanks to Dan's comment on the original question.

This seems to work:

(add-hook 'dired-mode-hook
      (lambda ()
        (dired-hide-details-mode)
        (dired-sort-toggle-or-edit)))
1
  • It should work, but hook with (dired-sort-toggle-or-edit) dosent work. I always have to sort it manually, any ideas how to fix it ?
    – slk500
    Jun 14 '20 at 12:07

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.