summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKyle Meyer <kyle@kyleam.com>2016-05-24 23:54:32 -0400
committerKyle Meyer <kyle@kyleam.com>2016-05-24 23:54:32 -0400
commit2e71246aa406b2d51441a961ec468833656b6798 (patch)
treec580f5a6bc39631b04d92c79c793cd8fd26ab601
parentc64354a4f6b8e65abd8ff0a3713253de5da59e07 (diff)
downloadsnakemake-mode-2e71246aa406b2d51441a961ec468833656b6798.tar.gz
Fix indentation for continued lines under naked rule
-rw-r--r--snakemake-mode.el6
-rw-r--r--snakemake-test.el15
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
@@ -487,6 +487,21 @@ rule abc:
(string=
"
rule abc:
+ output:
+ 'file'
+ 'text'"
+ (snakemake-with-temp-text
+ "
+rule abc:
+ output:
+ 'file'
+<point> 'text'"
+ (snakemake-indent-line)
+ (buffer-string))))
+ (should
+ (string=
+ "
+rule abc:
run:
with this:
"