summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKyle Meyer <kyle@kyleam.com>2014-06-29 12:13:22 -0400
committerKyle Meyer <kyle@kyleam.com>2014-06-29 12:13:22 -0400
commit86fe3711687224bc3c5750ecbba1b0a3e6a75335 (patch)
treed29ebc22eb7eceb163cff7830d769ef8f2b6f871
parent205f7004b7afb697b8cdf8290fbdca0dbebc7a37 (diff)
downloadsnakemake-mode-86fe3711687224bc3c5750ecbba1b0a3e6a75335.tar.gz
snakemake-run-subrule-line-p: Bound by rule start
Otherwise, if on first subrule or the top rule line, it returns true if there is a previous rule block whose last subrule is run. This function still relies on the caller (here `snakemake-indent-rule-line') to check that it is actually in a rule block. If it is not, it will return true if below a rule block whose last subrule is run.
-rw-r--r--snakemake-mode.el10
1 files changed, 6 insertions, 4 deletions
diff --git a/snakemake-mode.el b/snakemake-mode.el
index 4fed45a..5a1ea4a 100644
--- a/snakemake-mode.el
+++ b/snakemake-mode.el
@@ -180,10 +180,12 @@ indentation is determined by the location within the rule block.
(defun snakemake-run-subrule-line-p ()
(save-excursion
- (forward-line -1)
- (end-of-line)
- (save-match-data
- (re-search-backward snakemake-subrule-indented-re nil t)
+ (let ((rule-start (save-excursion
+ (end-of-line)
+ (re-search-backward snakemake-rule-re nil t))))
+ (forward-line -1)
+ (end-of-line)
+ (re-search-backward snakemake-subrule-indented-re rule-start t)
(string= (match-string 1) "run"))))
(defun snakemake-previous-subrule-value-column ()