From 1c0cacd6d6291eafa7698a87cf8dac20bde803b1 Mon Sep 17 00:00:00 2001 From: Kyle Meyer Date: Fri, 31 Mar 2017 23:38:43 -0400 Subject: snakemake-build-targets: set directory snakemake-build-targets needs to set default-directory to the Snakefile directory so that snakemake-term-process correctly reports whether there is an active terminal when the user initiates the call from a subdirectory. Conceptually, it also makes sense to handle the directory change in snakemake-build-targets. The docstrings for the lower-level snakemake-compile-targets and snakemake-term-build-targets specify that they correspond to a "snakemake ..." call, which implies that their caller is responsible for making sure they are called from the Snakefile directory. --- snakemake.el | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) (limited to 'snakemake.el') diff --git a/snakemake.el b/snakemake.el index 7778bbe..33d05e5 100644 --- a/snakemake.el +++ b/snakemake.el @@ -568,8 +568,7 @@ Snakemake-graph mode is a minor mode that provides a key, (defun snakemake-compile-targets (targets args) "Run non-interactive `compile' with 'snakemake [ARGS] -- TARGETS'." - (let ((default-directory (snakemake-snakefile-directory)) - (cmd (snakemake--make-command targets args))) + (let ((cmd (snakemake--make-command targets args))) (compile cmd) (push cmd compile-history))) @@ -616,8 +615,7 @@ could point to a script that runs (defun snakemake-term-build-targets (targets args) "Send 'snakemake [ARGS] -- TARGETS' to the terminal." - (let ((default-directory (snakemake-snakefile-directory))) - (snakemake-term-send (snakemake--make-command targets args)))) + (snakemake-term-send (snakemake--make-command targets args))) ;;;; General interface @@ -626,11 +624,12 @@ could point to a script that runs If a terminal is associated with the current Snakefile directory, send the command there. Otherwise, run the command with `compile'." - (funcall (if (snakemake-term-process) - #'snakemake-term-build-targets - #'snakemake-compile-targets) - targets - args)) + (let ((default-directory (snakemake-snakefile-directory))) + (funcall (if (snakemake-term-process) + #'snakemake-term-build-targets + #'snakemake-compile-targets) + targets + args))) ;;;###autoload (defun snakemake-build-targets-at-point (&optional args) -- cgit v1.2.3