Skip to main content

Questions tagged [directory-local-variables]

Directory local variables are used to apply the same Emacs settings to all files in a directory. https://www.gnu.org/software/emacs/manual/html_node/emacs/Directory-Variables.html

Filter by
Sorted by
Tagged with
2 votes
1 answer
63 views

In my ~/.emacs.d/init.el, I have auto-save-file-name-transforms set so that auto-save files are saved at paths such as /home/[user]/.emacs.d/auto-saves/#!home![user]!path!to!file#. This works fine. In ...
user570286's user avatar
0 votes
1 answer
411 views

I created a .dir-locals.el file using M-x add-dir-local-variable. The resulting file looks like this: ;;; Directory Local Variables -*- no-byte-compile: t -*- ;;; For more information see (...
PhilC's user avatar
  • 21
1 vote
1 answer
205 views

Summary (TL;DR): I want to disable Emacs from processing and/or applying any file-local variables, no matter what. However, I still want Emacs to process and apply directory-local variables specified ...
David's user avatar
  • 177
0 votes
1 answer
100 views

Is it possible to set org-refile-targets on a per-file basis? A similar question was asked here. But it did not get any answers. I am OK if it is set as a Local variable in the file or it is set up in ...
Deshmukh's user avatar
1 vote
2 answers
147 views

I have an elisp file that contains the following: (defun hello () (interactive) (message "Hello World")) (provide 'examples) When I call unload-feature examples RET, the function hello ...
Peter Petigru's user avatar
1 vote
2 answers
154 views

I have Emacs 27.1 on Ubuntu 22.04 and I'm trying to modify c-offsets-alist for this particular project with C and C++ source files. I have a c-style and a c-mode-common-hook in my .emacs: (defconst my-...
fencekicker's user avatar
0 votes
0 answers
179 views

I'm using Emacs 29.1 I have the following .dir-locals.el file: ((nil . ((compilation-error-regexp-alist-alist . '(acap "^#[0-9]+ [0-9]\.[0-9]+ \\(.+?\\):\\([0-9]+\\):\\([0-9]+\\).*" 1 2 3)) ...
Silex's user avatar
  • 821
0 votes
2 answers
553 views

I would like to hide dotfiles only in the home directory in dired buffers, but I do not know how to achieve this. I have been trying with the following: (use-package dired :ensure nil :commands (...
najjt's user avatar
  • 43
0 votes
1 answer
110 views

I have following .dir-locals.el file in my project directory: ((nil . ((logbook . "todo.org")))) and following function: (defun project-switch (&optional project-dir) "switch to ...
my_display_name's user avatar
2 votes
1 answer
937 views

My project structure is like this: -- Project Root - .git - rusttools - Cargo.toml - src - main.rs When I open main.rs in Emacs, eglot complains: [eglot] Server reports (type=1): ...
Lai Yu-Hsuan's user avatar
1 vote
0 answers
169 views

I use org-roam to take notes. I have two org-roam directories. The alternative one has a .dir-locals.el file where I set the value of org-roam-directory and org-roam-db-location with the path to the ...
NandKN's user avatar
  • 83
3 votes
1 answer
123 views

Why does someone attempt to have a duplicate key in a single .dir-locals.el? E.g., ((nil . (...)) (nil . (...)))
shynur's user avatar
  • 6,200
1 vote
0 answers
59 views

Say there're 3 files: /tmp/ | |__ LICENSE | |__ .dir-locals.el # Make LICENSE read-only | |__ .dir-locals-2.el # Do nothing ;;; /tmp/.dir-locals.el ((nil . ((eval . (when (string-match-p &...
shynur's user avatar
  • 6,200
3 votes
2 answers
365 views

;;; /tmp/test/.dir-locals.el ((auto-mode-alist . (("/\\.dir-locals\\(-2\\)?\\.el\\'" . lisp-data-mode) ("/[^/-][^/]*\\.el\\'" . emacs-lisp-mode))))...
shynur's user avatar
  • 6,200
2 votes
2 answers
248 views

Following this answer, I put the following lines in a .dir-locals.el file: ((latex-mode (TeX-engine . default) (mode . latex ) (TeX-master . "main") (ispell-buffer-session-localwords ...
tigerjack's user avatar
  • 175
4 votes
1 answer
471 views

I have a project where I want to disable format-all-mode for all my python files. I can do this manually by running M-x format-all-mode every time I open up a python file for that project. I tried ...
modulitos's user avatar
  • 2,632
0 votes
0 answers
17 views

I am trying to set face for org blocks to invisible for certain folders, so that it is nicer to read the org files with code. I am using .dir-locals.el file. So, this example for the begin line works: ...
Arktik's user avatar
  • 1,092
0 votes
1 answer
222 views

I have blacken-mode enabled on all python buffers like this: (add-hook 'python-mode-hook (lambda () (blacken-mode 1) ;; other config )) But on some ...
suvayu's user avatar
  • 1,678
0 votes
0 answers
91 views

I've been trying to override the user-full-name by setting it in .dir-locals ((org-mode . ((org-export-with-date . nil) (user-full-name . "Fullname") (org-export-with-...
ezy's user avatar
  • 131
4 votes
1 answer
957 views

So, I know that I can assign a variable via .dir-locals.el... ("thingy" (1 2 3 4)) but is there any way that I can append to an array, if at all? ("that" . "is correct") ...
Atlas Sullivan's user avatar
0 votes
0 answers
330 views

I have the following .dir-locals: ((nil . ((eval . (let ((project-root-dir (expand-file-name (locate-dominating-file default-directory ".dir-locals.el")))) (defun tokenize-...
daedsidog's user avatar
  • 229
0 votes
0 answers
31 views

I have a project I am working on which contains custom file extensions (.set) for which I would like to write my own mode for. However, I want this mode to exist only within the context of the project....
daedsidog's user avatar
  • 229
0 votes
0 answers
73 views

I have the following .dir-locals.el file. ((nil . ((ffip-project-root . "~/projects/xyzzy/git") (my-invalid-imports . ("org.junit.[A-Z]")))) (jdee-mode . ((my-invalid-...
Troy Daniels's user avatar
0 votes
0 answers
112 views

If I have a .dir-locals file that is meant as a template. How can I avoid the annoyance of being asked about whether or not the values are safe to load every time I open the file? I do want not to ...
James's user avatar
  • 1
0 votes
1 answer
205 views

How can I use a different theme (or color scheme) for files in a specific directory? Currently in my system, a single theme is applied to all buffers. The theme is chosen in ~/.emacs as (load-theme '...
norio's user avatar
  • 235
0 votes
1 answer
654 views

Here it says that the type of lsp-clients-pylsp-library-directories is (repeat string) How do I write my dir_locals.el file ? I tried this but it doesn't work (see here) ((lsp-mode . ((lsp-clients-...
user1632812's user avatar
1 vote
1 answer
393 views

I'm editing tab separated file with Emacs and csv-mode.el. When the document is open, I can align the columns with M-x csv-align-mode. How to make it automatically aligned when I open the file? Both ~/...
Zouppen's user avatar
  • 131
1 vote
1 answer
962 views

I'm setting up my python lsp using this video tutorial. My emacs init.el configuration file is here By default projectile-project-test-cmd runs the command python -m unittest discover. I want to ...
Rajkumar Natarajan's user avatar
2 votes
1 answer
453 views

I need this line in every my org files. It's tedious to include it in everyone of them.
nichijou's user avatar
  • 1,238
1 vote
1 answer
156 views

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 ...
ideasman42's user avatar
  • 9,513
1 vote
1 answer
156 views

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 ~/...
Nicholas Hubbard's user avatar
2 votes
1 answer
513 views

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-...
Mittenchops's user avatar
1 vote
0 answers
48 views

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 ...
kdb's user avatar
  • 1,591
2 votes
2 answers
1k views

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 ...
Saddle Point's user avatar
1 vote
2 answers
551 views

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 ...
Mittenchops's user avatar
0 votes
2 answers
371 views

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 " ...
Mittenchops's user avatar
2 votes
1 answer
196 views

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....
Mittenchops's user avatar
1 vote
1 answer
354 views

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 ...
shimon's user avatar
  • 51
1 vote
0 answers
311 views

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-...
Vince W.'s user avatar
  • 445
4 votes
1 answer
649 views

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....
Vince W.'s user avatar
  • 445
0 votes
2 answers
342 views

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-...
mcp's user avatar
  • 626
1 vote
0 answers
154 views

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 ...
fraxture's user avatar
  • 367
0 votes
1 answer
559 views

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/...
Roger PA's user avatar
2 votes
1 answer
612 views

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 ...
telotortium's user avatar
4 votes
2 answers
1k views

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-...
Vance Palacio's user avatar
2 votes
2 answers
156 views

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 a ...
Chmouel Boudjnah's user avatar
1 vote
1 answer
467 views

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 ...
Acciaierie Stahlberg's user avatar
2 votes
1 answer
386 views

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 ...
SFbay007's user avatar
  • 594
3 votes
1 answer
1k views

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-...
Mikael Springer's user avatar
0 votes
1 answer
768 views

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 ...
Mikael Springer's user avatar