ppcompile: An Emacs Package to Help Coding Locally

If you are a C/C++ programmer like me, you may experience jumping around different machines to write and compile your code, or you may write code on different machines for different projects, and scp/rsync/ftp the projects around. It works, but it's a bit tedious and takes too much burden on our brains.

For example, say I have two projects that should be compiled on their compiling machines respectively. There are two obvious workflows for writing code for them "simultaneously":

  1. Write code locally, rsync files to their compiling machine and compile them, fix errors according to the compiling result.

    Pros: I have only one coding environment to maintain, and I have full control of it. Install packages? Start some services? No problem, just a few commands.

    Cons: I have to sync the source code, spot the errors by my eyes and fix them accordingly.

  2. Write code on the compiling machine, compile them and fix errors locally there, taking the advantage of M-x next-error.

    Pros: M-x next-error works like a charm to fix errors, just a piece of cake. Eye friendly.

    Cons: Several Emacs environment to maintain, and I don't always have the root privilege.

    Update: Tramp is a built-in package for editing remote files, which also falls into this category, although it's quite handy to edit single files like confs, at least for me.

(Update: There is another option using sshfs, which mounts the remote FS, it's a general and nice solution if you have a stable network.)

So I was wondering if there is a way to take the good part of both approaches so that I have the full privilege and fix compiling errors locally as if I were compiling locally? Well, the answer was yes, and ppcompile was my solution for it.

ppcompile stands for ping-pong compile, as it works like playing ping-pong. First, it rsync's the files to the compiling machines ("ping"). Second, it gets the result back ("pong") and gets them fixed locally.

It works now, and I hope it helps you too. :)


See also

comments powered by Disqus