From ee2bd9aab5b8e9503eb4c24f90d7b0b9817bad53 Mon Sep 17 00:00:00 2001 From: Kyle Meyer Date: Wed, 11 May 2016 21:27:45 -0400 Subject: Extend snakemake-block-bounds function Include name and block type. --- snakemake.el | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) (limited to 'snakemake.el') 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 -- cgit v1.2.3