• `("bash" "-c" "cd \"$1\" && cmake .. && make" "--" ,(concat (straight--

    From hongyi.zhao@gmail.com@21:1/5 to All on Thu Dec 2 22:42:55 2021
    This is a bash and Emacs related problem. So I post it here for some help. Sorry to bother again if you think it's not so relevant to shell.


    I try to install vterm through straight's use-package integration with
    the following configuration:

    1.
    (use-package vterm
    :straight (
    :pre-build (
    ("rm" "-fr" "build")
    ("mkdir" "build")
    ("bash" "-c" "cd build && cmake .. && make")
    )))

    2.
    (use-package vterm
    :straight (
    :pre-build (
    (shell-command "rm -fr build && mkdir build && cd $_
    && cmake .. && make")
    )))

    3.
    (use-package vterm
    :straight (
    :pre-build (
    ("rm" "-fr" "build")
    ("mkdir" "build")
    `("bash" "-c" "cd \"$1\" && cmake .. && make" "--"
    ,(concat (straight--repos-dir "emacs-libvterm") "build"))
    )))


    In the above methods, 1. and 2. can, but 3. can't build the vterm
    module when I'm running `M-x straight-rebuild-package RET vterm RET'.

    As you can see from my above description, the following one works:

    ("bash" "-c" "cd build && cmake .. && make")

    But the following one doesn't work:

    `("bash" "-c" "cd \"$1\" && cmake .. && make" "--" ,(concat (straight--repos-dir "emacs-libvterm") "build"))

    The above method is based on the suggestion given by Radon Rosborough here [1]:

    ***
    I'd recommend (untested):

    `("bash" "-c" "cd \"$1\" && whatever-command" "--" ,some-other-directory)
    ***

    [1] https://github.com/raxod502/straight.el/issues/800#issuecomment-933009729

    Any hints for this problem?

    Regards,
    HZ

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Janis Papanagnou@21:1/5 to All on Fri Dec 3 07:48:03 2021
    Have you forgotten (or ever learned) how to formulate a sensible
    subject line?

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From hongyi.zhao@gmail.com@21:1/5 to Janis Papanagnou on Fri Dec 3 01:13:05 2021
    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?

    I failed to come up with a reasonable subject for this question.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Spiros Bousbouras@21:1/5 to hongy...@gmail.com on Fri Dec 3 09:49:08 2021
    On Fri, 3 Dec 2021 01:13:05 -0800 (PST)
    "hongy...@gmail.com" <hongyi.zhao@gmail.com> wrote:
    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?

    I failed to come up with a reasonable subject for this question.

    How about "bash/emacs related problem" ? Crossposting to gnu.emacs.help
    would have probably also been a good idea.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From hongyi.zhao@gmail.com@21:1/5 to Spiros Bousbouras on Fri Dec 3 03:22:49 2021
    On Friday, December 3, 2021 at 5:49:14 PM UTC+8, Spiros Bousbouras wrote:
    On Fri, 3 Dec 2021 01:13:05 -0800 (PST)
    "hongy...@gmail.com" <hongy...@gmail.com> wrote:
    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?

    I failed to come up with a reasonable subject for this question.
    How about "bash/emacs related problem" ? Crossposting to gnu.emacs.help
    would have probably also been a good idea.

    I've separately posted a mail on the Emacs user list.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From hongyi.zhao@gmail.com@21:1/5 to Janis Papanagnou on Fri Dec 3 04:10:56 2021
    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)