Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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:

"/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?

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.

like image 563
themagicalyang Avatar asked Jan 27 '26 19:01

themagicalyang


1 Answers

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. 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))))))
like image 173
phils Avatar answered Jan 29 '26 11:01

phils



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!