1

When using emacs for writing erlang source code, I have made the following configuration. In the emacs, 6 windows are open at the same time, 4 windows for source code writing, 1 windows for terminal shell, 1 windows for erlang shell.

After one source code modification, I have use command "m-x ter" to switch "terminal shell", then using "m-p" for recovering last history command, then pressing "enter" to run. Then using "c-x, left " to switch to erlang shell, then press m-p to repeat last command.

The above two switch process seems a little long, could you have better solution?

Chen Yu
  • 3,955
  • 1
  • 24
  • 51

1 Answers1

4

The compile function is the general mechanism for such things, and the compile-command variable tells it what to do (as a shell command to run).

By default, the command is make, so if you have a Makefile, you're already sorted.

If not, and writing one isn't appropriate, then you can customise compile-command for your files, perhaps using local variables.

File-local variables for this purpose are covered in the linked Q&A.

You can also use Directory-local variables if you want it to automatically apply to all files under a given directory.

Or if there's a general pattern which can be applied to all erlang files, everywhere, then you might set up compile-command using the erlang mode hook.

Finally, you can just supply the command on demand. Called interactively, M-x compile prompts you for the command to run, and uses the previous command as the default for the next time.

Community
  • 1
  • 1
phils
  • 71,335
  • 11
  • 153
  • 198