From b5a4676d998c846ccf6c907ad2dd13cc17574055 Mon Sep 17 00:00:00 2001 From: Kyle Meyer Date: Fri, 3 Jun 2016 00:20:19 -0400 Subject: Add snakemake-recompile-no-dryrun command --- lisp/km-snakemake.el | 42 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 lisp/km-snakemake.el (limited to 'lisp') 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 + +;; Author: Kyle Meyer +;; 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 . + +;;; 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 -- cgit v1.2.3