On Friday, December 3, 2021 at 2:48:08 PM UTC+8, Janis Papanagnou wrote:
Have you forgotten (or ever learned) how to formulate a sensible
subject line?
Basically, this is a problem on running bash command from Emacs by passing a parameter. More specifically, I noticed the following form works:
("bash" "-c" "cd build && cmake .. && make")
Now, I want to set the directory of `cd` command by passing a parameter, so I tried the following elisp code:
`("bash" "-c" "cd \"$1\" && cmake .. && make" "--" ,(concat (straight--repos-dir "emacs-libvterm") "build"))
In the above code, the leading "`" indicates that this is backquote constructs allow me to quote a list, but selectively evaluate elements of that list [1]. In this case, the last element of the list will be evaluated and passed to bash as the first
parameter, due to that it has the ",()" construct.
In detail, ,(concat (straight--repos-dir "emacs-libvterm") "build") will be expanded to the following:
"/home/werner/.emacs.d/straight/repos/emacs-libvterm/build"
and then be passed to the bash process as the first parameter. As a result, the above elisp command is equivalent to the following:
("bash" "-c" "cd \"$1\" && cmake .. && make" "--" "/home/werner/.emacs.d/straight/repos/emacs-libvterm/build")
But according to my tries, using the above code line directly works, but the backquote construct doesn't work. This puzzles me most.
[1]
https://www.gnu.org/software/emacs/manual/html_node/elisp/Backquote.html
--- SoupGate-Win32 v1.05
* Origin: fsxNet Usenet Gateway (21:1/5)