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?

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

1 Answer 1


Thanks to Dan's comment on the original question.

This seems to work:

(add-hook 'dired-mode-hook
      (lambda ()
  • 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, 2020 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.