Compile History

You can set a predefined compile history for compile-command using this snippet:

(setq compile-history
      (list (rho/custom-generate-compile-string) ;; private function
            "cd ~/path/to/project1 && make -k target1"
            "cd ~/path/to/project2 && make -k target2"
            ))
 
(setq compile-command (car compile-history))