File and Directory Variables

I must admit that I seldom use file local variables. Mostly that’s because I have a standard default configuration for each file type but it’s also because I can never remember the exact format. That’s just silly, of course, because Emacs has a command to add them pretty much automatically.

The same thing is true with directory local variables but with the additional complication that I never think about using them. I have code in my init.el that checks if the current directory is ~/org/blog and if so sets certain variables and toggles things like fill-mode and visual-line-mode. That’s crazy because it’s far easier to just use directory local variables to do the same thing.

But again, I could never remember how to set up these variables. Fortunately, Marcin Borkowski (mbork) has me covered. He’s got an excellent post on how to add file and directory local variables and deal with the gotchas that come up. Really, there’s no excuse for my sturm und dang. It mostly boils down to just calling add-file-local-variable and add-directory-local-varible and filling in the blanks but be sure to read his post for the details.

This entry was posted in General and tagged . Bookmark the permalink.