From da7dd5027472f231533dcc40e2e19d3c83874f12 Mon Sep 17 00:00:00 2001 From: Kyle Meyer Date: Wed, 5 Nov 2014 00:23:48 -0500 Subject: 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. --- lisp/init-snakemake.el | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) (limited to 'lisp/init-snakemake.el') 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") -- cgit v1.2.3