-
-
Notifications
You must be signed in to change notification settings - Fork 61
Included the option to call zig build run from the project root.
#74
base: master
Are you sure you want to change the base?
Conversation
|
In my opinion, we shouldn't support other build file names than |
|
I agree with @joachimschmidt557, this addition seems unnecessary. |
| root-dir | ||
| (dir (directory-file-name | ||
| (replace-regexp-in-string "^Directory " "" default-directory)))) | ||
| (while (and (< count zig-project-root-search-up) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's locate-dominating-file for all of this btw, so no need to search directories upwards yourself.
| (interactive) | ||
| (zig--run-cmd "run" (buffer-file-name) "-O" zig-run-optimization-mode)) | ||
|
|
||
| (defun zig--find-project-root () |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Really what I'd suggest instead of these changes is to add a (likely trivial) snippet that allows project.el to find the project root of Zig project. Then you can use project-* functions as needed in zig-project-build-run below.
|
I added that works, the same way the zig-compile works. Just adding that snippet would be enough to make it work |
For interactive projects its nice to do a quick build run from any file your working on.
The new
zig-project-build-runinteractive function identifies the root of the project and calls the appropriate executable with the argumentsbuild run.By default it is bound to
C-c C-p.This PR adds two additional customs
zig-project-build-fileis the name of the file you wish to use as your build file. It defaults tobuild.zigzig-project-root-search-upis the number of directories you wish to search up for thezig-project-build-file. This is used to ensure the function terminates.If the project root cannot be found,
zig-project-build-runindicates so in Messages.