summaryrefslogtreecommitdiff
path: root/lisp
diff options
context:
space:
mode:
authorKyle Meyer <kyle@kyleam.com>2014-11-05 00:23:48 -0500
committerKyle Meyer <kyle@kyleam.com>2014-11-05 00:23:48 -0500
commitda7dd5027472f231533dcc40e2e19d3c83874f12 (patch)
treef527e815afaad4ef37fb1b2246f4dbd15a980a03 /lisp
parentac8539e5c02753207c3d28406063f79abbb7fbe9 (diff)
downloademacs.d-da7dd5027472f231533dcc40e2e19d3c83874f12.tar.gz
Handle compiling non-project files with Snakemake
Allow option to prevent km/snakemake-compile-project-file-at-point from append project path, but keep default-directory set to project root. This is useful if compiling from rule files that already list the file with its full path.
Diffstat (limited to 'lisp')
-rw-r--r--lisp/init-snakemake.el17
1 files changed, 11 insertions, 6 deletions
diff --git a/lisp/init-snakemake.el b/lisp/init-snakemake.el
index 65230de..720d456 100644
--- a/lisp/init-snakemake.el
+++ b/lisp/init-snakemake.el
@@ -11,12 +11,17 @@
(set (make-local-variable 'compile-command)
(snakemake-compile-command))))
-(defun km/snakemake-compile-project-file-at-point ()
- "Run Snakemake to produce project file at point."
- (interactive)
- (let ((compile-command (concat (snakemake-compile-command) " "
- (km/project-filename-at-point)))
- (default-directory (projectile-project-root)))
+(defun km/snakemake-compile-project-file-at-point (arg)
+ "Run Snakemake to produce project file at point.
+With prefix ARG, use file name as is, without trying to append
+the project's path."
+ (interactive "P")
+ (let* ((fname (if arg
+ (thing-at-point 'filename)
+ (km/project-filename-at-point)))
+ (compile-command (concat (snakemake-compile-command) " "
+ fname))
+ (default-directory (projectile-project-root)))
(call-interactively 'compile)))
(autoload 'snakemake-compile-command "snakemake-mode")