Stack Exchange Network

Stack Exchange network consists of 174 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [directory-local-variables]

0
votes
0answers
14 views

Is eval/mode removed from dir local special keys?

I put into .dir-locals.el: ((nil . ((eval . (message "OK"))))) I don't see message when I revert-buffer for file in directory. I can't find docs about eval + mode in Emacs v25 info. Are those ...
4
votes
1answer
73 views

Can I override the “nil” variables in .dir-locals.el with a more specific mode?

There is a project called Piglit with a .dir_locals.el file like this: ((nil . ((indent-tabs-mode . t))) (python-mode . ((indent-tabs-mode . nil)))) I think the intention is that most files in the ...
0
votes
0answers
22 views

file-local variables vs directory-local variables in Auctex

I have a file with the following content, let's call it tmp.tex \emph{Hello} %%% Local Variables: %%% mode: latex %%% TeX-master: "main" %%% End: and another file main.tex that includes the ...
1
vote
0answers
43 views

How to set tags-table-list as a per-directory local variable?

I have two tags tables that I would like to be searched/visited when I'm working on one of my R packages. I am able to set them globally with the following code in my .emacs config file: (setq tags-...
2
votes
0answers
54 views

Setting org-babel-load-languages in .dir-locals.el

As per the title, I'd like to set the org-babel-load-languages (to contain ditaa and calc languages) for a specific project only. The only solution I found so far is this one ( (org-mode . ...
0
votes
2answers
59 views

Load package in dir-locals

Sorry, I'm new to emacs and I'm sure this is a very basic question. For my personal projects I prefer spaces for indentation, whereas work requires smart-tabs (tabs for indentation, spaces for ...
0
votes
1answer
131 views

Enable .dir-locals.el variables inside just opened buffer

I'm programmtically create a new buffer as a result of shell command (defun jira-ticket-view (&optional jira-ticket) "Open Jira Ticket Inside Emacs" (interactive) (setq jiraURL (get-jira-...
0
votes
1answer
84 views

dir-locals not working

I wanted to have wc-mode (a minor mode) enabled when I edit any markdown file in a specific directory. So, I created a .dir-locals.el file and added the following to it: ((markdown . ((wc-mode . t))))...
0
votes
0answers
183 views

Why are my .dir-locals not being applied even though they are loaded

Still on a never ending quest to get per project settings working for python using tramp and .dir-locals. Hitting a strange problem when I open a buffer I am asked if i would like to run my .dir-...
0
votes
0answers
34 views

load remote .el file in .dir-locals.el?

Can I use .dir-local.el to load a (remote) file with indentation setting, something like: In .dir-locals.el: ((clojure-mode (eval . (load "~/emacs/indents.el")))) In indents.el: ;; use 2 spaces ...
0
votes
1answer
158 views

Why are my dir-locals always malformed

I was reading about dir-locals and wanted to set up per project settings. However whatever I try results in a malformed function. Why is this ? .dir-locals.el:4:1:Warning: ‘(php-mode (php-executable ....
0
votes
1answer
70 views

Customized c-offsets-alist override c-file-style in dir-locals

Assuming I customized my default C indentation settings through M-x customize-variable c-offsets-alist: (custom-set-variables '(c-offsets-alist (quote ((statement-case-open . 0) (...
0
votes
1answer
65 views

Can't get directory local variables to work - Debugger encountered Lisp error

I've tried adding directory variables in several ways and I keep getting the same error. First, I was editing .dir.locals.el, but when that didn't work, I added each variable individually using M-x ...
0
votes
1answer
63 views

Problems trying to turn on auto-fill in a directory local way

I am inexperienced in Emacs and very new to directory-local variables, so please forgive any obvious things I may be missing. I am trying to have auto-fill mode activated for all the files in a ...
1
vote
2answers
140 views

How to use magit-commit-arguments to set commit author

I'm trying to use a .dir_locals.el file to override the author field in Git commits (so when I'm committing something in a work repo, I use my work email). It looks like magit-commit-arguments is ...
0
votes
1answer
22 views

How not to propagate dired-actual-switches as a directory variable to the sub directories

I want to set dired-actual-switches for the directory /path/to/data, but not for data's subdirectories. So I generated the following .dir-locals.el file in /path/to/data: ;;; Directory Local ...
1
vote
1answer
92 views

Override per-directory settings on a file type basis

I'm using dir-locals-set-class-variables in my git directories to apply whitespace-mode settings differently, based on the needs of each repo. if my sf directory, for all subfolders, I want to use ...
2
votes
1answer
166 views

How to trust code in .dir.locals.el and pass the (is it safe) test?

I have this code in my .dir-locals.el file: (eval . (let ((root (projectile-project-root))) (setq-local company-clang-arguments (list (concat "-I" root "headers")...
2
votes
0answers
144 views

How to set indentation style substatement-open offset parameter from .dir-locals.el?

Within CC mode, for C and C++ files inside a directory, I'd like to have the open braces following a case/do/for/if/while not indented, whatever the style is and without having to change anything in ....
1
vote
1answer
1k views

flycheck-gcc-include-path in .dir-locals.el

In my .dir-locals.el I have: (cpp-mode . (setq flycheck-gcc-include-path '("/home/<user>/<project>/include"))) This doesnt seem to set flycheck-gcc-include-path, any ideas why? Also is ...
3
votes
1answer
379 views

.dir-local.el misunderstanding

I generated a .dir-locals.el by calling the function add-dir-local-variable, giving it the path for the project for which I want the variable, the variable itself, and its value. The generated file ...
2
votes
0answers
65 views

Evaluation of .dir-locals.el in shell?

I observed that directory local variables, defined in .dir-locals.el, are set for files, dired-buffers, new buffers, but not for shell or eshell buffers (well, that is also the case for buffers ...
3
votes
0answers
280 views

How to mark risky variable as safe?

I have some customization in my .dir-locals.el. Some of variables set there are unsafe and when I set them and visit some file in dir for the first time Emacs nicely asks me to save their name-value ...
3
votes
1answer
84 views

how to apply parent directory and current directory variable together

there is a .dir-locals in parent directory ((nil (global-auto-revert-ignore-buffer . t))) and there is a .dir-locals in current directory ((nil (tags-file-name "TAGS"))) but when I visit files in ...
1
vote
1answer
395 views

Compile command as a directory variable?

I am working on a cmake project and I would like to set a directory variable containing the correct compile command. I added this to the root directory of the project in a .dir-locals.el file: ;;; ...
4
votes
2answers
647 views

How to customize major mode initialization with local variables?

Seems like most major modes clear all local variables before initializing. It also seems like many major modes read variables while initializing to customize their behavior. If I want to set a file ...
9
votes
2answers
2k views

How can I set directory local variable in relative to .dir-locals.el file location?

I often find myself in the situation where I'm told to put relative paths as directory local variable. For example cmake-ide's cmake-ide-project-dir and cmake-ide-build-dir. Of course this is not very ...
4
votes
1answer
95 views

How to stop auto backup in some directory in Emacs

In general I want Emacs to save a backup file for me, except in some special directories. I tried to define a Directory Local Variables, and add: ((nil . ((make-backup-files . nil)))) But it seem ...
3
votes
1answer
1k views

Calling functions in .dir-locals in Emacs

I'm trying to activate flycheck-mode by default when opening any file in my project's directory. I'm a bit of an elisp newbie, my .dir-locals.el file looks like this: ((nil . (mode . flycheck-mode)) ...
10
votes
1answer
644 views

Mark a local variable safe for any value

The variable safe-local-variable-values can store name/value pairs that are safe as file-local or directory-local. However sometimes I want to say any value is valid for a given variable. The manual ...
4
votes
1answer
489 views

How can I turn off flycheck minor mode for given directory

So my question is like in title. I want to turn off flycheck minor mode for all files in directory. I have specified in my .emacs file that it should be on in c++-mode, c-mode and few others, but I ...
10
votes
1answer
759 views

Trust .dir-locals.el

I want to put some config outside my init.el file into .dir-locals.el, i.e the following: ((nil (let ((dirs '(".cask" "core" "packages" "modules" "snippets" "themes"))) (mapc #'(lambda (path) (...
3
votes
2answers
664 views

How to set major mode for a file in .dir-locals.el?

I would like to set the major mode for a file as you would using file-local variables Local Variables: mode: text End: but in .dir-locals.el in order not to “pollute” the file in question. Is this ...
4
votes
1answer
97 views

How can I make an interactive function be local to directories?

I want to make it so that I have interactive functions that can only be called from buffers in a certain directory, like variables in .dir-locals.el. Is there a way to do this? For example, say I'm ...
7
votes
3answers
528 views

White list of .dir-locals.el

Is it possible to load .dir-locals.el file without prompting me, but also without adding values I am configuring in that file to my init.el in custom-set-variables? The reason I want it is that that ...
2
votes
0answers
83 views

org-journal-mode new entry ignores .dir-locals.el

I am using org-journal-mode. I have created .dir-locals.el in my ~/Documents/journal directory and it gets correctly applied if I open a file the usual way. However, if I hit the C-xC-j to add a new ...
1
vote
1answer
129 views

How to enable auto-revert-mode for files under a certain directory

I have my org files kept synchronized via rsync with various devices. These buffers are usually open in any running emacs instances due to agenda and capture. I want emacs to re-read these files from ...
20
votes
1answer
2k views

Reloading directory-local variables

How do you reload directory-local variables? I would like to modify a .dir-locals.el and have such changes applied to the current Emacs session.
7
votes
1answer
2k views

variable project root folder in .dir-locals.el

I'm using company-mode for completion in C++ code. To tell clang backend of company where the include files for the current project are I have to use the following .dir-locals.el file ((c++-mode (...
10
votes
1answer
482 views

How are file paths mapped to subdirectories in .dir-locals.el?

I like the idea of .dir-locals.el. I have my own .dir-locals.el file in my home directory that should set all the variables for directories/files that I open unless there is .dir-locals.el closer to ...
14
votes
2answers
959 views

Remember permission to execute “risky” local variables

In many of my projects I use .dir-locals.el files to setup project specific variables such as compile commands. Upon opening a file within a directory containing such a file, emacs complains about "...
1
vote
0answers
23 views

Using multiple .dir-locals.el [duplicate]

Say I have two directories A and B, with A containing B. Both A and B have directory local variables specified through their own .dir-locals.el files. B/.dir-locals.el whenever emacs visits a file in ...