A productivity extension for programmers who use Emacs.
Running files is for executing programs that are contained in one file. It is ideal for scripts, but will compile the file if necessary. Although Project-run might find the right shell command to run your program, you still need to have the compiler or interpreter installed.
M-x run-file (
M-x run-f for short or run-file button) to execute the file that is in the current buffer.
Project run will know how to run the program based on the major mode. If the programming language isn't supported yet, then you'll be prompted to tell it how to run the program.
If the file isn't being run the way you want, then you can change it by using
M-x file-config (
M-x file-con) to change the way the current buffer will be evaluated. This will be remembered until you close Emacs.
Projects are for executing a group of files together. It is ideal for programs that use many files.
While projects can replace makefiles in small projects. Projects are more of improvement on top of makefiles.
Projects will be remembered by Emacs until you delete them with
M-x delete-project (
Projects are useful because you can test your program without having to think about
M-x compile or
Lastly, changing projects will mess with your source code. You still have to make files, then add them to project, or delete the files after deleting a project; projects are just a way to associate an execution procedure with source code files and run it without thinking too much.
Projects have several parts:
The name of the project. Useful for referencing the project later
- compile command:
The shell command to compile the programs. Ideally it would be to run a make file. and should empty for purely interpreted languages
- run command:
The shell command to execute the program
The directory path where the compile and run commands should be run. It is usually the path to the makefile
- file associations:
Files that have been added to the project, are files where the
M-x run(or run button) can be used to run the project. Removing them from the project does not delete them.
You can create a new project by using
M-x create-project (
M-x cr lol). It will prompt you for all the data above.
The name, compile command, run command, and path can be changed later by using
M-x project-config (
File associations can be changed later by using
M-x add-project-files (
M-x add-p) or
M-x remove-project-files (
After creating a project, you can run it by using
M-x functions can be found in a menu-bar item called Run, and there should be two buttons on the tool-bar for
Download and extract project-run-master to your emacs installation path. For example:
And rename it from
Then put the following somewhere in your init (~/.emacs) file:
(add-to-list 'load-path "~/.emacs.d/elpa/project-run")