I put the following in my .emacs file:
(require 'dired-x)
(add-hook 'dired-load-hook '(lambda () (require 'dired-x)))
(setq dired-omit-files-p t)
(setq dired-omit-files
(concat dired-omit-files "\\|^\\..+$\\|-t\\.tex$\\|-t\\.pdf$"))
But C-x d still shows me .pdf and .tex files. Did I get the syntax wrong in that last line?
Bonus question: Is there a way to get Dired to hide hidden directories, like .git folders?
Your regexp will match
*-t.texfiles, not*.texones.With recent version of Emacs, it should be sufficient to add the following section to
~/.emacsto filter what you want:Update: by default, dired-omit-files regexp filters out special directories
.and... If you don’t want this behavior, you can just override defaults (instead of inheriting them with concat):The regexp
^\\.[^.]will match any string of length 2+ starting with a dot where second character is any character except the dot itself. It’s not perfect (will not match filenames like “..foo”), but should be ok most of the time.