branch: elpa/zig-mode commit 2d0eb23e6b5c12b946f12c23803157605c90f02f Merge: 909e263 bab3143 Author: Andrea Orru <and...@orru.io> Commit: GitHub <nore...@github.com>
Merge pull request #55 from arqv/optim-mode Add `zig-test-optimization-mode` and `zig-run-optimization-mode` --- zig-mode.el | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/zig-mode.el b/zig-mode.el index 5b8503b..799bbbe 100644 --- a/zig-mode.el +++ b/zig-mode.el @@ -50,6 +50,18 @@ :safe #'stringp :group 'zig-mode) +(defcustom zig-run-optimization-mode "Debug" + "Optimization mode to run code with." + :type 'string + :safe #'stringp + :group 'zig-mode) + +(defcustom zig-test-optimization-mode "Debug" + "Optimization mode to run tests with." + :type 'string + :safe #'stringp + :group 'zig-mode) + ;; zig CLI commands (defun zig--run-cmd (cmd &optional source &rest args) @@ -97,13 +109,13 @@ If given a SOURCE, execute the CMD on it." (defun zig-test-buffer () "Test buffer using `zig test`." (interactive) - (zig--run-cmd "test" (buffer-file-name) "-O" "ReleaseFast")) + (zig--run-cmd "test" (buffer-file-name) "-O" zig-test-optimization-mode)) ;;;###autoload (defun zig-run () "Create an executable from the current buffer and run it immediately." (interactive) - (zig--run-cmd "run" (buffer-file-name))) + (zig--run-cmd "run" (buffer-file-name) "-O" zig-run-optimization-mode)) (defvar zig-return-to-buffer-after-format nil "Enable zig-format-buffer to return to file buffer after fmt is done.")