[英]How to concat string in emacs elisp .dir-locals.el?
((c++-mode
(rmsbolt-command . "/path/to/project/build_asm_for_rmsbolt.sh")
I want to pass a variable rmsbolt-temp-dir
as a argument to the build_asm_for_rmsbolt.sh
script, so idea is to concat the strings and rmsbolt-command
should then look like:我想将变量
rmsbolt-temp-dir
作为参数传递给build_asm_for_rmsbolt.sh
脚本,所以想法是连接字符串,然后rmsbolt-command
应该如下所示:
"/path/to/project/build_asm_for_rmsbolt.sh /tmp/rmsbolt-123as"
So how do i concat the string variable to the command in .dir-locals.el?那么如何将字符串变量连接到 .dir-locals.el 中的命令?
I have tried:我试过了:
((c++-mode
(rmsbolt-command . ((eval . (concat "/path/to/project/build_asm_for_rmsbolt.sh" rmsbolt-temp-dir))))))
but this doesn't work.但这不起作用。 Elisp is a bit daunting, I am trying to learn as i speak.
Elisp 有点令人生畏,我正在尝试边说边学。
In dir-local specs eval
is a pseudo-variable, so you use that as the variable name, and then the associated value is the elisp that gets evaluated.在 dir-local 规范中,
eval
是一个伪变量,因此您将其用作变量名称,然后关联的值是被评估的 elisp。 Try something like this:尝试这样的事情:
((c++-mode
(rmsbolt-temp-dir . "/tmp/rmsbolt-123as")
(eval . (setq-local rmsbolt-command
(concat "/path/to/project/build_asm_for_rmsbolt.sh "
(shell-quote-argument rmsbolt-temp-dir))))))
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.