{"id":8252,"date":"2019-08-18T11:56:27","date_gmt":"2019-08-18T15:56:27","guid":{"rendered":"https:\/\/irreal.org\/blog\/?p=8252"},"modified":"2019-08-18T11:56:27","modified_gmt":"2019-08-18T15:56:27","slug":"using-directory-local-variables","status":"publish","type":"post","link":"https:\/\/irreal.org\/blog\/?p=8252","title":{"rendered":"Using Directory Local Variables"},"content":{"rendered":"<p>I\u2019ve written before about directory local variables (<a href=\"http:\/\/irreal.org\/blog\/?p=5380\">1<\/a>, <a href=\"http:\/\/irreal.org\/blog\/?p=7512\">2<\/a>) and how they can be useful for setting variables or actions with a directory-wide scope. Over at the Emacs reddit, fearbedragons has a nice tip that leverages them to slightly reduce his workflow friction.<\/p>\n<p>Fearbedragons has a project in which he needs to make a lot of small compiles as he goes about his testing. To help with that he set up a small <code>.dir-locals.el<\/code> file in the project directory that <a href=\"https:\/\/www.reddit.com\/r\/emacs\/comments\/cr91vw\/tip_use_dirlocalsel_to_make_entire_projects_on\/\">automatically compiles the whole directory when any file is saved<\/a>. You may or may not want to do that for your own projects but the same idea works for any action that you want to take on a file event. As fearbedragons says, \u201cYou don\u2019t always need it, but it\u2019s sure handy when you do.\u201d<\/p>\n<p>This post is already longer than fearbedragons\u2019 whole tip so stop reading here and go on over to reddit to take a look at the tip. It\u2019s also worthwhile to follow his link to the dir-locals documentation to see how things work. The syntax can be a bit confusing but, as usual, Emacs can help you out by writing the entries for you. Just call <code>add-dir-local-variable<\/code> and follow the prompts. This is a useful facility that I, at least, do not use nearly enough.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I\u2019ve written before about directory local variables (1, 2) and how they can be useful for setting variables or actions with a directory-wide scope. Over at the Emacs reddit, fearbedragons has a nice tip that leverages them to slightly reduce &hellip; <a href=\"https:\/\/irreal.org\/blog\/?p=8252\">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-8252","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\/8252","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=8252"}],"version-history":[{"count":1,"href":"https:\/\/irreal.org\/blog\/index.php?rest_route=\/wp\/v2\/posts\/8252\/revisions"}],"predecessor-version":[{"id":8253,"href":"https:\/\/irreal.org\/blog\/index.php?rest_route=\/wp\/v2\/posts\/8252\/revisions\/8253"}],"wp:attachment":[{"href":"https:\/\/irreal.org\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=8252"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/irreal.org\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=8252"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/irreal.org\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=8252"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}