From 5ed5f8c56896a106f65227a9eef20d637c25e9b7 Mon Sep 17 00:00:00 2001 From: Dominik Kellner Date: Fri, 20 Sep 2024 21:30:38 +0200 Subject: [PATCH 1/2] Kill process if it's still running before starting a new one --- justl.el | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/justl.el b/justl.el index 11a03ef..2864289 100644 --- a/justl.el +++ b/justl.el @@ -285,6 +285,21 @@ ARGS is a plist that affects how the process is run. (defun justl-recompile () "Execute the same just target again." (interactive) + ;; This is copied and adapted from `compilation-start'. + (let ((comp-proc (get-buffer-process (current-buffer)))) + (if comp-proc + (if (or (not (eq (process-status comp-proc) 'run)) + (eq (process-query-on-exit-flag comp-proc) nil) + (yes-or-no-p "The last target is still running; kill it? ")) + (condition-case () + (progn + (interrupt-process comp-proc) + (sit-for 1) + (delete-process comp-proc)) + (error nil)) + (error "Cannot have two processes in `%s' at once" + (buffer-name))))) + (justl--make-process justl--compile-command (list :buffer (buffer-name) :process "just" :directory (if justl-justfile From 27be6e0ba0b2d0a1ffedeb0e33ffae71663f411d Mon Sep 17 00:00:00 2001 From: Dominik Kellner Date: Tue, 24 Sep 2024 12:11:33 +0200 Subject: [PATCH 2/2] Update changelog --- Changelog.org | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Changelog.org b/Changelog.org index d150478..33184cd 100644 --- a/Changelog.org +++ b/Changelog.org @@ -1,3 +1,8 @@ +* Unreleased + +- Kill process if it's still running before starting a new one in the same + buffer. + * 0.14 - Respect buffer-local environments, for compatibility with ~envrc.el~