summaryrefslogtreecommitdiff
path: root/snakemake.el
diff options
context:
space:
mode:
authorKyle Meyer <kyle@kyleam.com>2016-09-01 20:34:31 -0400
committerKyle Meyer <kyle@kyleam.com>2016-09-01 20:39:09 -0400
commita59b453b0abcf3642a29fb855e70e626e8a6209d (patch)
tree559b2c072f6196c0bc251802284400bfed9260d8 /snakemake.el
parent7b210fcd668bc5ba92a0e23f9f5e7b77c77de12f (diff)
downloadsnakemake-mode-a59b453b0abcf3642a29fb855e70e626e8a6209d.tar.gz
snakemake-check-target: Pull out regexp
Diffstat (limited to 'snakemake.el')
-rw-r--r--snakemake.el7
1 files changed, 5 insertions, 2 deletions
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")