From 489cb9610e7435c32f46117f4bf719796eadf2f3 Mon Sep 17 00:00:00 2001 From: Sameer Rahmani Date: Fri, 1 Jul 2022 22:33:28 +0100 Subject: [PATCH] Add sync mode to the builder's elisp function --- resources/emacs/serene-dev.el | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/resources/emacs/serene-dev.el b/resources/emacs/serene-dev.el index 76c2d71..a400469 100644 --- a/resources/emacs/serene-dev.el +++ b/resources/emacs/serene-dev.el @@ -35,18 +35,25 @@ (defvar serene/compile-buffer "*compile*") -(defmacro serene/builder (command &optional buf-name) +(defmacro serene/builder (command &optional buf-name sync) "Run the given COMMAND via the builder script. -Use the optional BUF-NAME as the buffer." +Use the optional BUF-NAME as the buffer. + +If SYNC is non-nil it will block." (let ((buf (or buf-name (format "*%s*" command)))) - `(projectile-run-async-shell-command-in-root (format "./builder %s" ,command) ,buf))) + (if (not sync) + `(projectile-run-async-shell-command-in-root + (format "./builder %s" ,command) ,buf) + `(projectile-run-shell-command-in-root + (format "./builder %s" ,command) ,buf)))) -(defun serene/compile () +(defun serene/compile (&optional sync) "Compile the project. -It will run the `./builder compile' asynchronously." +It will run the `./builder compile' asynchronously or synchronously if +SYNC is non-nil." (interactive) - (serene/builder "compile" serene/compile-buffer)) + (serene/builder "compile" serene/compile-buffer sync)) (defun serene/build ()