summaryrefslogtreecommitdiff
path: root/snakemake.el
diff options
context:
space:
mode:
authorKyle Meyer <kyle@kyleam.com>2016-05-11 21:27:45 -0400
committerKyle Meyer <kyle@kyleam.com>2016-05-11 21:29:43 -0400
commitee2bd9aab5b8e9503eb4c24f90d7b0b9817bad53 (patch)
tree99d2035fa9f731fc5f18bf30b68d8febe366ef95 /snakemake.el
parent001fc4ad589893515375f439d56e5a1ee169d527 (diff)
downloadsnakemake-mode-ee2bd9aab5b8e9503eb4c24f90d7b0b9817bad53.tar.gz
Extend snakemake-block-bounds function
Include name and block type.
Diffstat (limited to 'snakemake.el')
-rw-r--r--snakemake.el17
1 files changed, 7 insertions, 10 deletions
diff --git a/snakemake.el b/snakemake.el
index 47df68d..213a8c1 100644
--- a/snakemake.el
+++ b/snakemake.el
@@ -328,16 +328,13 @@ target.
This function returns a list for consistency with other
target-returning functions, but any non-nil return value is
currently limited to a single-item list."
- (when (and (derived-mode-p 'snakemake-mode)
- (snakemake-block-bounds))
- (save-excursion
- (end-of-line)
- (re-search-backward snakemake-rule-or-subworkflow-re)
- (let ((rule (and (string= (match-string-no-properties 1) "rule")
- (match-string-no-properties 2))))
- (when rule
- (and (or (not targets-only) (snakemake-check-target rule))
- (list rule)))))))
+ (when (derived-mode-p 'snakemake-mode)
+ (let* ((info (snakemake-block-info))
+ (rule (and (equal (nth 0 info) "rule")
+ (nth 1 info))))
+ (when rule
+ (and (or (not targets-only) (snakemake-check-target rule))
+ (list rule))))))
(defun snakemake--prompt (prompt default)
(concat prompt