reddit / emacs

Compile stuff remotely from a major mode using TRAMP

InternalImpact2 · 2022-03-31 19:29
Hi I'm trying to setup emacs to edit and compile verilog sources remotely. I'm using TRAMP to do this. Editing files runs great, but I don't know how to setup the compile commands to run the verilog parser remotely using emacs compile. Emacs tries to compile it locally. -*- mode: compilation; default-directory: "/ssh:user@odcvde:/slowfs/265/users/user/FM_Debugging_Hard_Verifications/hv_labs/lab5/rtl/" -*- Compilation started at Thu Mar 31 16:02:33 /bin/sh: line 2: /ssh:user@odcvde:vlogan: No such file or directory It disobeys also the default shell using sh instead of bash Also, misc stuff, I'm having problems with TRAMP and the bash prompt. It initially have problems to detect the prompt, **It had bold characters**, so I worked around it adding \* to the prompt regexp and worked again, but I noticed that there's still some garbage in the shell. Is forcing certain terminal type or changing the prompt a more "robust" solution? Thanks
eerie-descent · 2022-04-01 00:56
Tramp's shell prompt detection can be iffy. One of the things I do is check the TERM environment variable in my profile scripts, and if it's "dumb", I'll make sure the prompt is very simple and something Tramp can parse. Regarding your compilation problem, I suspect its an issue with whatever major/minor modes you're using for Verilog. A lot of them do not know from Tramp, which will lead to issues like you're seeing, where Tramp filenames are being passed, with the remote part still in them, to local processes. You can either add Tramp support to the mode, which isn't normally that hard, and will probably be appreciated by the upstream, or you can use the standard `M-x compile`, and pass in the build commands (which can be saved in `.dir-locals.el`, but that's another kettle of fish). The `compile` built-in command is Tramp aware so shouldn't need any tweaking.
redguardtoo · 2022-04-01 05:37
You could just customize `compile-command`. The key idea of `M-x compile` is simple. Emacs run a command line in shell, the output could be parsed by `compilation-error-regexp-alist`. See its documentation.
InternalImpact2 · 2022-04-01 19:59
The program I need to run depends on bash. How I can change the shell interpreter that compile mode uses? the default is /bin/sh /bin/sh: line 2: vlogan: command not found
InternalImpact2 · 2022-04-01 20:09
I modified the shell to not include color, control or modifier escape sequences, and, from that side, everything is working fine now. However, I need to use bash for one of the environment scripts I need prior to launch. I managed to change the M-x shell interpreter, but the M-x compile shell still defaults to sh. How I can change the shell executable?
redguardtoo · 2022-04-02 10:09
See https://unix.stackexchange.com/questions/20729/ssh-start-a-specific-shell-and-run-a-command-on-the-remote-machine
eerie-descent · 2022-04-03 13:04
I don't know a way off the top of my head to get `compile` to use a different shell, although, since this is Emacs, there's probably a way. However, you could use a wrapper script that just bounces into bash to execute the commands you need.