From 66b3a0ba018d475aafb21d403f27c05c6a5b76b6 Mon Sep 17 00:00:00 2001 From: Uros Perisic Date: Mon, 4 Feb 2019 07:42:20 -0800 Subject: [PATCH] Make `spacemacs/nim-compile-run` work with current buffer file. Naming the main file `main.nim` is a `C` convention, not a `Nim` convention. In fact, `Nimble` defaults to naming the main file after the project at initialization. I will soon add a function that parses the Nimble configuration for project entry point and compiles that. Until then, this is a solid compromise between flexibility and reliability. I also added a doc-string to the function. --- CHANGELOG.develop | 2 ++ layers/+lang/nim/packages.el | 3 ++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.develop b/CHANGELOG.develop index 4ce2686b9..816d7bf01 100644 --- a/CHANGELOG.develop +++ b/CHANGELOG.develop @@ -1649,6 +1649,8 @@ Other: **** Nim - Added key binding ~SPC m h h~ to show symbol documentation (thanks to Valts Liepiņš) +- Make =spacemacs/nim-compile-run= work with current buffer file instead of + defaulting to =main.nim= (thanks to Uroš Perišić) - Replace =company-capf= with =company-nimsuggest= in =company-backends-nim-mode= to improve responsiveness (thanks to Uroš Perišić) - Declare all prefix names (='(compile goto help)=) for =nim-mode= (thanks to diff --git a/layers/+lang/nim/packages.el b/layers/+lang/nim/packages.el index 1ede6b5fc..b1fa38eb2 100644 --- a/layers/+lang/nim/packages.el +++ b/layers/+lang/nim/packages.el @@ -39,8 +39,9 @@ :config (progn (defun spacemacs/nim-compile-run () + "Compile current buffer file." (interactive) - (shell-command "nim compile --run main.nim")) + (shell-command (concat "nim compile --run " (buffer-file-name)))) (spacemacs/declare-prefix-for-mode 'nim-mode "mc" "compile") (spacemacs/declare-prefix-for-mode 'nim-mode "mg" "goto")