From a59b453b0abcf3642a29fb855e70e626e8a6209d Mon Sep 17 00:00:00 2001 From: Kyle Meyer Date: Thu, 1 Sep 2016 20:34:31 -0400 Subject: snakemake-check-target: Pull out regexp --- snakemake.el | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'snakemake.el') diff --git a/snakemake.el b/snakemake.el index 5ac4762..8c3bf7e 100644 --- a/snakemake.el +++ b/snakemake.el @@ -246,6 +246,10 @@ The file list is determined by the output of (buffer-string) (error "Error finding file targets"))))))) +(defconst snakemake-invalid-target-re + (regexp-opt (list "MissingRuleException" + "RuleException"))) + (defun snakemake-check-target (target &optional directory) "Return non-nil if TARGET is a valid target for DIRECTORY's Snakefile." (snakemake-with-cache directory (target) @@ -254,8 +258,7 @@ The file list is determined by the output of (goto-char (point-min)) ;; Lean towards misclassifying targets as valid rather than ;; silently dropping valid targets as invalid. - (not (looking-at (regexp-opt (list "MissingRuleException" - "RuleException"))))))) + (not (looking-at snakemake-invalid-target-re))))) (declare-function org-element-context "org-element") (declare-function org-element-property "org-element") -- cgit v1.2.3