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 --- init.el | 5 +++++ lisp/km-snakemake.el | 42 ++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 47 insertions(+) create mode 100644 lisp/km-snakemake.el diff --git a/init.el b/init.el index 649632e..e4cc273 100644 --- a/init.el +++ b/init.el @@ -1822,6 +1822,11 @@ (magit-change-popup-key 'snakemake-popup :action ?p ?o))) +(use-package km/snakemake + :defer t + :init + (define-key km/compile-map "l" #'km/snakemake-recompile-no-dryrun)) + (use-package ess-site :mode ("\\.[rR]\\'" . R-mode) :config 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