From 46dbf8f490442173c1b10008977be07936a00094 Mon Sep 17 00:00:00 2001 From: Henrik Lissner Date: Sun, 18 Mar 2018 22:18:34 -0400 Subject: [PATCH] lang/lua: improve main.lua detection in +lua/run-love-game --- modules/lang/lua/autoload.el | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/modules/lang/lua/autoload.el b/modules/lang/lua/autoload.el index 2fc165a41..d244c2000 100644 --- a/modules/lang/lua/autoload.el +++ b/modules/lang/lua/autoload.el @@ -11,9 +11,10 @@ (defun +lua/run-love-game () "Run the current project with Love2D." (interactive) - (async-shell-command - (format "%s %s" - (or (executable-find "love") - (if IS-MAC "open -a love.app")) - (shell-quote-argument (doom-project-root))))) + (when-let* ((root (locate-dominating-file buffer-file-name "main.lua"))) + (async-shell-command + (format "%s %s" + (or (executable-find "love") + (if IS-MAC "open -a love.app")) + (shell-quote-argument (file-name-directory root))))))