[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: How to run compile command on remote machine with a different direct
From: |
Michael Albinus |
Subject: |
Re: How to run compile command on remote machine with a different directory |
Date: |
Sat, 11 Apr 2020 08:52:14 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) |
Wenguang Wang <address@hidden> writes:
Hi,
> My project has multiple directories and I want to invoke the build
> command from any directory. My build system prints file path relative
> to the project root directory. Therefore, when I build it on the
> remote machine using emacs on the remote machine, I have to do this:
>
> cd /abs/path/to/project_root ; ./build.sh
>
> This makes emacs know that the file names in the compile errors starts
> from which directory and I can use the “next-error” command to load
> the file and jump to the right line.
>
> However, when I run the compile command from tramp, this command fails
> with: “No such directory found via CDPATH environment variable”.
>
> Although I can start the command with: /bin/bash -c "cd
> /abs/path/to/project_root ; ./build.sh”, it does not help because
> emacs does not know the relative file path in the compile error has
> changed to a different directory.
>
> Is there a way to make this work under tramp?
You should work on a buffer which has the default-directory
"/ssh:user@host:/abs/path/to/project_root". There you can call "M-x compile",
and replace in the minibuffer the default command "make -k" by "./build.sh".
That's how I work all the time.
> Thanks!
> -Wenguang
Best regards, Michael.