I am trying to write a .dir-locals.el file. I want to dynamically find the directory where the file is located and merge it using "TAGS". This was my first attempt:
((nil . ((tags-file-name . (concat default-directory "TAGS")))))
This does not work. I am not an expert at Emacs Lisp. What is wrong with him?
Combining the sanityinc solution and some other snippet that I found elsewhere, I get:
((nil . ((eval . (setq tags-file-name (concat (locate-dominating-file buffer-file-name ".dir-locals.el") "TAGS"))))))
I think it does what you want (a little inefficient, since we have to search .dir-locals.el twice).
In linux, how about:
(getenv "PWD")
- , .dir-locals.el:
.dir-locals.el
((nil . ((eval . (setq tags-file-name (concat default-directory "TAGS"))))))
, , default-directory nil dir-locals, , .
default-directory
nil
dir-locals
, tags-file-name , . , .
tags-file-name
, ? TAGS - , .
TAGS
: add-on project-local-variables, , , . .
project-local-variables
, , (concat default-directory "TAGS") .
(concat default-directory "TAGS")
tags-file-name, : (setq tags-file-name (concat default-directory "TAGS")).
(setq tags-file-name (concat default-directory "TAGS"))