GNU Emacs
Emacs
Dashboard

30.12 Subdirectory Switches in Dired

You can insert subdirectories with specified ls switches in Dired buffers using C-u i. You can change the ls switches of an already inserted subdirectory at point using C-u l.

Dired preserves the switches if you revert the buffer. Deleting a subdirectory forgets about its switches.

Using dired-undo (see Dired Marks vs. Flags) to reinsert or delete subdirectories that were inserted with explicit switches can bypass Dired’s machinery for remembering (or forgetting) switches. Deleting a subdirectory using dired-undo does not forget its switches. When later reinserted using i, it will be reinserted using its old switches. Using dired-undo to reinsert a subdirectory that was deleted using the regular Dired commands (not dired-undo) will originally insert it with its old switches. Reverting the buffer, however, will relist it using the buffer’s default switches. If any of this yields problems, you can easily correct the situation using C-u i or C-u l.

Dired does not remember the R switch. Inserting a subdirectory with switches that include the R switch is equivalent to inserting each of its subdirectories using all remaining switches. For instance, updating or killing a subdirectory that was inserted with the R switch will not update or kill its subdirectories.

The buffer’s default switches do not affect subdirectories that were inserted using explicitly specified switches. In particular, commands such as s that change the buffer’s switches do not affect such subdirectories. (They do, however, affect subdirectories without explicitly assigned switches.)

You can make Dired forget about all subdirectory switches and relist all subdirectories with the buffer’s default switches using M-x dired-reset-subdir-switches. This also reverts the Dired buffer.