Open DivineDominion opened 5 years ago
I use Projectile and usually have something like this in my .dir-locals.el
file:
((nil . ((projectile-project-compilation-cmd . "bmk makeapp -r -h -o my_app src/my_app.bmx")))
(blitzmax-mode . ((indent-tabs-mode . t)
(tab-width . 4)
(fill-column . 80))))
I then run projectile-compile-project
(C-c p c
) to recompile the project.
However, I would like to make it easier to compile the current buffer using Emacs' compile
command. I'd also like to have something like MaxIDE's "compile and run" functionality.
I'm happy to accept a pull request if this is something you'd like to try implementing, or I can come up with a fix for it.
Oh that's a neat combo already!
What would be the obstacles to implementing "build & run"? I have yet to try, but I thought one can get away with executing open path/to/the.app
in the shell on Mac, for example.
I came up with this for compile and run, but I'm not really happy with it:
(defun blitzmax-mode-compile-and-run ()
"Compile and run contents of the current file."
(interactive)
(compile (format "bmk makeapp -r -h %s && %s"
buffer-file-name
(file-name-sans-extension buffer-file-name))))
Running M-x blitzmax-mode-compile-and-run
will then compile the file in the current buffer and run the executable. I'd like to add support for enabling and disabling debug mode before adding it to blitzmax-mode.
I think a better solution for projects is to customize Projectile's projectile-project-compilation-cmd
to include running - something like this:
((nil . ((projectile-project-compilation-cmd . "bmk makeapp -r -h -o my_app src/my_app.bmx && ./my_app")))
(blitzmax-mode . ((indent-tabs-mode . t)
(tab-width . 4)
(fill-column . 80))))
Totally forgot about the bmk
tool!
My temporary TextMate 2 setup compiles and runs the app, but the debug output and print statements appear nowhere.
The MaxIDE launches processes and pipes the output into the output window; and using stdin, if I interpret this correctly, you can debug-step through the program. That's beyond my elisp.
But the compile settings sound simple enough. I guess you don't want to switch between DEBUG/RELEASE depending on user settings, but implement a Build & Run for debug and release mode, right?
I've added quickrun support, which makes it possible to compile and run the current buffer without having to drop to the command line. Projectile is still the better choice for compiling projects, but quickrun is useful for testing out small pieces of BlitzMax code.
That's a cool addition for quick tests! I always had MaxIDE running for the purpose of auto-saving to its tmp/untitled.bmx
and executing the compiled result.
Doesn't this warrant linking to bmax as a supported language for the quickrun repo? https://github.com/syohex/emacs-quickrun/#support-programming-languages
https://github.com/textmate/blitzmax.tmbundle
The TextMate bundle uses environment settings to compile projects, not just buffers. Thanks to
.tm_properties
files, these can be set per directory/project, which is nice. I think with the power of.dir-locals.el
to auto-load when opening a buffer, one can do the same for Emacs.My elisp isn't that good, that's why I didn't work on a PR right away and want to coordinate efforts first. What do you think?