Questions tagged [directory-local-variables]

Filter by
Sorted by
Tagged with
0
votes
1answer
40 views

How to set a “#+SETUPFILE: .xxx.setup” as dir local?

I need this line in every my org files. It's tedious to include it in everyone of them.
0
votes
1answer
17 views

How to manually define trusted paths for directory local variables '.dir-locals.el'?

I would like to define a list of trusted paths. Where dir-locals.el can be loaded without asking me. Without having to be concerned with safe-local-variable-valuesWhich isn't very practical if the ...
1
vote
1answer
36 views

Using two programming languages with the same file extension

I am just starting to set up a perl environment in emacs but the problem is that I already program with prolog and both languages use the .pl file extension. I have two directory ~/src/prolog and ~/...
0
votes
1answer
17 views

Automatically enable a mode with dir-locals.el

I'm trying to achieve the effect of automatically calling M-x importmagic-mode whenever I open a python file, but I need to do this in a directory specific way, using dir-locals.el. I have this in dir-...
0
votes
2answers
74 views

elpy flymake does not recognize local .pylintrc

I have the following in the project root for my .pylintrc: [FORMAT] # Maximum number of characters on a single line. max-line-length=1000 # String used as indentation unit. This is usually " ...
1
vote
0answers
23 views

Ignore file- and directory-variables when using “emacs -Q”?

I am using emacs -Q as editor for git, because my startup is too heavy for "quick editing" use and using emacsclient will hang when git is invoked with M-x shell-command. However, as a ...
1
vote
2answers
53 views

Directory Variable: .dirs-local.el with regexp

We can specify modes : (c-mode . ((c-file-style . "BSD") (subdirs . nil))) Or directories : ("src/imported" . ((nil . ((change-log-default-name . "ChangeLog.local"))))) Is there ...
0
votes
1answer
42 views

.dir-locals for specific directory but not its children

How to set a directory local variable for a directory itself non-recursively? I don't want the variable set in .dir-locals.el affect the sub-directories. Edited: My use case is: I'd like to hide dot ...
2
votes
1answer
44 views

realgud pdb with .dir-locals.el

I'm trying to use directory local variables so my realgud:pdb invocation can be: Run pdb (like this): /home/username/work/place/environments/default/bin/python -m pdb /home/username/work/place/scratch....
0
votes
0answers
22 views

Set multiple dir-local variables for the same mode

I understand from here, that I can use dir-locals.el to customize modes, such as given in the example: ;; Warn about spaces used for indentation: (haskell-mode . ((eval . (highlight-regexp ...
1
vote
1answer
74 views

Can not read dir-local variable from a hook function

hope you are all well. Before stating problem, let me tell you my setup. I am using Emacs 27.1, using pyvenv, projectile, lsp-mode, lsp-python-ms for python-mode. I have set WORKON_HOME environmental ...
0
votes
0answers
12 views

Set mode for new Tex files in a directory

How to change the default mode for new Tex files in a directory? I tried putting this into a .dir-local.el: ((nil (tex-default-mode . context-mode) (TeX-default-mode . context-mode))) but newly ...
1
vote
1answer
38 views

does tramp mode look at .dir-locals

I'm using emacs over tramp to edit a project inside a vm on my local machine. It has something like this: ssh:vm:~/projects/project/.dir-locals.el ssh:vm:~/projects/project/src/tests/file-i'm-editing....
1
vote
0answers
42 views

how best to set the `projectile-regenerate-tags` command

I have a fortran project I'm working on and I cannot figure out the right way to use .dir-locals to set the projectile-tags-command here is my dir-locals.el file: ( (f90-mode (projectile-tags-...
0
votes
0answers
26 views

specify predicate in safe-local-variable-values

I am trying to configure safe-local-variable-values in my init.el so that all string values for projectile-project-name in any .dir-locals.el file are considered safe. (custom-set-variables '(safe-...
0
votes
0answers
34 views

ispell dictionary in .dir-locals.el

Aim: I am writing papers in different languages mostly in multifile latex projects. Thats why I would like to set the ispell dictionary in the directory local variables. Problem: Flyspell is not using ...
0
votes
1answer
28 views

Apply settings in .dir-locals.el to both c and c++ major modes

Is there a way to specify the same settings for c-mode and c++-mode without repeating the alist? I have: ((c-mode . ((comment-start . "/* ") (comment-end . " */") (comment-...
0
votes
0answers
8 views

How to set block comment style in .dir-locals.el

When I do C-c C-k (c-toggle-comment-style) the value of comment-style remains indent. To achieve the same result as setting block comments, in my .dir-locals.el I have: ((c-mode . ((comment-start . "/...
0
votes
1answer
79 views

How to use concat to get the path in .dir-locals.el with flycheck-clang-include-path

I am using the following content to include headers to my project using .dir-locals.el ((c++-mode . ((flycheck-clang-language-standard . "c++14") (flycheck-clang-include-path "/Users/user/...
1
vote
0answers
21 views

Is there a way to undo hook attached to major modes in spacemacs?

In my .spacemacs file I set the following hooks to run: (add-hook 'js-mode-hook 'prettier-js-mode) (add-hook 'web-mode-hook 'prettier-js-mode) I, however, have projects where I don't want these to ...
2
votes
1answer
101 views

At what point are file-local and dir-local variables applied to a newly-loaded buffer?

I'm currently attempting to call the function company-org-roam--init-hook from org-mode-hook in order to enable the company-org-roam backend in org-roam buffers. In some of the files in which this ...
0
votes
0answers
47 views

Add custom project config loading via `.dir-local.el`

I have a custom config for a project which I would like to load whenever emacs is started from project's root directory. The custom config lies in path/to/project/emacs.d/custom-init.el. I have also ...
2
votes
2answers
265 views

How to set minor mode variables in dir-locals?

Im writing an lsp-mode purescript client and couldn't figure out how to override the default config options using a .dir-locals file. For example, I have a defcustom : defcustom lsp-purescript-use-...
1
vote
1answer
77 views

wrong-type-argument listp eval

I have a project which is centralized in a directory. The directory contains the .dir-locals.el file with the following content, just a defun: (defun pr--narrow-buffer () "Narrow the current buffer ...
2
votes
1answer
119 views

use .dir-locals.el to setup blacklist (based on projectile root) for ccls (c++mode server)

I use this setup to setup blacklists for ccls in my project: ( (prog-mode (ccls-initialization-options . (:index (:blacklist [ "^/Users/xxx/proj/dir1/" "^/Users/xxx/proj/dir2/(dir3|dir4)/"]))) ) How ...
5
votes
1answer
241 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-...
3
votes
1answer
282 views

Use lsp-mode for some projects and ggtags for others

Is there a way to configure Emacs to activate lsp-mode for some projects and ggtags for other projects? Maybe using .dir-locals.el? I code C++ and the project I most often work on doesn't support lsp-...
0
votes
1answer
267 views

cmake-ide defining variables

I have a project I build using cmake. To build this project, I need to define several options like -DPRODUCT=amd64 -DXML_DIR=/opt/xml_database Normally, I either pass these as -D or configure them in ...
0
votes
1answer
492 views

Fail to start Python Language Server when Python virtual env is activated from .dir-locals.el

I have the following in a .dir-locals.el ((python-mode . ((pyvenv-workon . "3.7") (projectile-project-compilation-cmd . "python -m unittest fixcompdb_test.py")))) I use lsp-mode and the Pyls ...
32
votes
2answers
4k 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.
1
vote
1answer
389 views

evaluating fn in dir-locals.el

I realize there are a number of questions surrounding this topic, but I'm trying use a global function that I've written inside a project .dir-locals.el. Specifically, I wrote a function to add a ...
4
votes
1answer
127 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 ...
21
votes
2answers
2k 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 "...
0
votes
1answer
372 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
2answers
436 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 ...
2
votes
0answers
134 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 . ...
1
vote
1answer
474 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-...
1
vote
1answer
458 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))))...
1
vote
1answer
140 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 ...
1
vote
0answers
634 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
1answer
581 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 ....
8
votes
3answers
745 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 ...
0
votes
1answer
218 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
196 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
376 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
30 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 ...
12
votes
2answers
1k 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 ...
2
votes
1answer
421 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
273 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 ....
2
votes
1answer
3k 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 ...