From 2e71246aa406b2d51441a961ec468833656b6798 Mon Sep 17 00:00:00 2001 From: Kyle Meyer Date: Tue, 24 May 2016 23:54:32 -0400 Subject: Fix indentation for continued lines under naked rule --- snakemake-mode.el | 6 ++++-- snakemake-test.el | 15 +++++++++++++++ 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/snakemake-mode.el b/snakemake-mode.el index e89d25b..5b4fb28 100644 --- a/snakemake-mode.el +++ b/snakemake-mode.el @@ -280,11 +280,13 @@ returned." (looking-at-p "^\\s-*$"))) (forward-line -1))) (and (looking-at - (concat snakemake-field-key-indented-re "\\s-*")) + (concat snakemake-field-key-indented-re "\\s-*\\(.*\\)")) (not (equal (match-string-no-properties 1) "run")) (cond (goto-first-p - (- (match-end 0) (line-beginning-position))) + (if (equal (match-string-no-properties 2) "") + above-indent + (- (match-beginning 2) (line-beginning-position)))) ((< field-indent initial-indent) field-indent))))))))))))) diff --git a/snakemake-test.el b/snakemake-test.el index fd4daac..80850d7 100644 --- a/snakemake-test.el +++ b/snakemake-test.el @@ -486,6 +486,21 @@ rule abc: (should (string= " +rule abc: + output: + 'file' + 'text'" + (snakemake-with-temp-text + " +rule abc: + output: + 'file' + 'text'" + (snakemake-indent-line) + (buffer-string)))) + (should + (string= + " rule abc: run: with this: -- cgit v1.2.3