-
Notifications
You must be signed in to change notification settings - Fork 55
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
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.
@@ -123,6 +135,31 @@ If given a SOURCE, execute the CMD on it." | |||
(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.
For interactive projects its nice to do a quick build run from any file your working on.
The new
zig-project-build-run
interactive 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-file
is the name of the file you wish to use as your build file. It defaults tobuild.zig
zig-project-root-search-up
is 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-run
indicates so in Messages.