diff options
author | Kyle Meyer <kyle@kyleam.com> | 2017-03-31 23:38:43 -0400 |
---|---|---|
committer | Kyle Meyer <kyle@kyleam.com> | 2017-03-31 23:40:03 -0400 |
commit | 1c0cacd6d6291eafa7698a87cf8dac20bde803b1 (patch) | |
tree | f28e94cd297d2428c3421b97f86f493d7bfaef46 | |
parent | 349980879a66493ed421e9c83f4857662267b8df (diff) | |
download | snakemake-mode-1c0cacd6d6291eafa7698a87cf8dac20bde803b1.tar.gz |
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.
-rw-r--r-- | snakemake.el | 17 |
1 files changed, 8 insertions, 9 deletions
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) |