summaryrefslogtreecommitdiff
path: root/lisp/km-snakemake.el
diff options
context:
space:
mode:
authorKyle Meyer <kyle@kyleam.com>2016-06-03 00:20:19 -0400
committerKyle Meyer <kyle@kyleam.com>2016-06-03 00:20:19 -0400
commitb5a4676d998c846ccf6c907ad2dd13cc17574055 (patch)
treee6024a32463d2a247ee510495e9ce20d63c26e06 /lisp/km-snakemake.el
parente6276c428c52bcbacb9558e8efcb6179b0f7d751 (diff)
downloademacs.d-b5a4676d998c846ccf6c907ad2dd13cc17574055.tar.gz
Add snakemake-recompile-no-dryrun command
Diffstat (limited to 'lisp/km-snakemake.el')
-rw-r--r--lisp/km-snakemake.el42
1 files changed, 42 insertions, 0 deletions
diff --git a/lisp/km-snakemake.el b/lisp/km-snakemake.el
new file mode 100644
index 0000000..4b9c1fb
--- /dev/null
+++ b/lisp/km-snakemake.el
@@ -0,0 +1,42 @@
+;;; km-snakemake.el --- Snakemake extensions
+
+;; Copyright (C) 2012-2016 Kyle Meyer <kyle@kyleam.com>
+
+;; Author: Kyle Meyer <kyle@kyleam.com>
+;; URL: https://github.com/kyleam/emacs.d
+
+;; This program is free software; you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation, either version 3 of the License, or
+;; (at your option) any later version.
+
+;; This program is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+;; GNU General Public License for more details.
+
+;; You should have received a copy of the GNU General Public License
+;; along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+;;; Code:
+
+
+(require 'compile)
+(require 'snakemake)
+
+;;;###autoload
+(defun km/snakemake-recompile-no-dryrun ()
+ "Recompile last Snakemake call, removing --dryrun."
+ (interactive)
+ (unless (buffer-live-p compilation-last-buffer)
+ (user-error "No previous compile command found"))
+ (with-current-buffer compilation-last-buffer
+ (let ((command (car compilation-arguments)))
+ (if (string-prefix-p snakemake-program command)
+ (setf (car compilation-arguments)
+ (replace-regexp-in-string "--dryrun" "" command))
+ (user-error "Last compile was not with %s" snakemake-program)))
+ (recompile)))
+
+(provide 'km-snakemake)
+;;; km-snakemake.el ends here