{"id":7512,"date":"2018-09-29T13:20:18","date_gmt":"2018-09-29T17:20:18","guid":{"rendered":"http:\/\/irreal.org\/blog\/?p=7512"},"modified":"2018-09-29T13:20:18","modified_gmt":"2018-09-29T17:20:18","slug":"file-and-directory-variables","status":"publish","type":"post","link":"https:\/\/irreal.org\/blog\/?p=7512","title":{"rendered":"File and Directory Variables"},"content":{"rendered":"<p>\nI must admit that I seldom use file local variables. Mostly that&rsquo;s because I have a standard default configuration for each file type but it&rsquo;s also because I can never remember the exact format. That&rsquo;s just silly, of course, because Emacs has a command to add them pretty much automatically.\n<\/p>\n<p>\nThe 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 <code>init.el<\/code> that checks if the current directory is <code>~\/org\/blog<\/code> and if so sets certain variables and toggles things like <code>fill-mode<\/code> and <code>visual-line-mode<\/code>. That&rsquo;s crazy because it&rsquo;s far easier to just use directory local variables to do the same thing.\n<\/p>\n<p>\nBut again, I could never remember how to set up these variables. Fortunately, Marcin Borkowski (mbork) has me covered. He&rsquo;s got an excellent post on <a href=\"http:\/\/mbork.pl\/2018-09-23_add-dir-local-variable_and_dotted_pairs\">how to add file and directory local variables<\/a> and deal with the gotchas that come up. Really, there&rsquo;s no excuse for my <i>sturm und dang<\/i>. It mostly boils down to just calling <code>add-file-local-variable<\/code> and <code>add-directory-local-varible<\/code> and filling in the blanks but be sure to read his post for the details.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I must admit that I seldom use file local variables. Mostly that&rsquo;s because I have a standard default configuration for each file type but it&rsquo;s also because I can never remember the exact format. That&rsquo;s just silly, of course, because &hellip; <a href=\"https:\/\/irreal.org\/blog\/?p=7512\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[5],"tags":[18],"class_list":["post-7512","post","type-post","status-publish","format-standard","hentry","category-general","tag-emacs"],"_links":{"self":[{"href":"https:\/\/irreal.org\/blog\/index.php?rest_route=\/wp\/v2\/posts\/7512","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/irreal.org\/blog\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/irreal.org\/blog\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/irreal.org\/blog\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/irreal.org\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=7512"}],"version-history":[{"count":1,"href":"https:\/\/irreal.org\/blog\/index.php?rest_route=\/wp\/v2\/posts\/7512\/revisions"}],"predecessor-version":[{"id":7513,"href":"https:\/\/irreal.org\/blog\/index.php?rest_route=\/wp\/v2\/posts\/7512\/revisions\/7513"}],"wp:attachment":[{"href":"https:\/\/irreal.org\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=7512"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/irreal.org\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=7512"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/irreal.org\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=7512"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}