diff options
author | Kyle Meyer <kyle@kyleam.com> | 2015-03-07 18:23:22 -0500 |
---|---|---|
committer | Kyle Meyer <kyle@kyleam.com> | 2015-03-07 18:23:22 -0500 |
commit | e4db2a70f5cef845d4e80d43d071c875992a81cf (patch) | |
tree | ad6f857fdcc89d2da54ca5dab4bb3f8a95f09b92 /snakemake-mode.el | |
parent | 4d66de6e7943a214e58d5888e1ca0b347d7288d2 (diff) | |
download | snakemake-mode-e4db2a70f5cef845d4e80d43d071c875992a81cf.tar.gz |
Use syntax code for whitespace regex
Diffstat (limited to 'snakemake-mode.el')
-rw-r--r-- | snakemake-mode.el | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/snakemake-mode.el b/snakemake-mode.el index 0d233ef..cb928d5 100644 --- a/snakemake-mode.el +++ b/snakemake-mode.el @@ -100,7 +100,7 @@ "Regexp matching a rule or subworkflow field key.") (defconst snakemake-field-key-indented-re - (concat "^[ \t]+" snakemake-field-key-re) + (concat "^\\s-+" snakemake-field-key-re) "Regexp matching a field key, including indentation.") (defconst snakemake-builtin-function-re @@ -150,9 +150,9 @@ rule blocks (or on a blank line directly below), call (let ((start-indent (current-indentation))) (beginning-of-line) (cond - ((looking-at-p (concat "^[ \t]*" snakemake-rule-or-subworkflow-re)) + ((looking-at-p (concat "^\\s-*" snakemake-rule-or-subworkflow-re)) (delete-horizontal-space)) - ((looking-at-p (concat "^[ \t]*" snakemake-field-key-re)) + ((looking-at-p (concat "^\\s-*" snakemake-field-key-re)) (delete-horizontal-space) (indent-to snakemake-indent-field-offset)) ((snakemake-below-naked-field-p) @@ -177,19 +177,19 @@ rule blocks (or on a blank line directly below), call "Return non-nil if point is in block or on first blank line following one." (save-excursion (beginning-of-line) - (when (looking-at-p "^ *$") + (when (looking-at-p "^\\s-*$") (forward-line -1)) (end-of-line) (let ((start (point))) (and (re-search-backward snakemake-rule-or-subworkflow-re nil t) - (not (re-search-forward "^ *$" start t)))))) + (not (re-search-forward "^\\s-*$" start t)))))) (defun snakemake-below-naked-field-p () "Return non-nil if point is on first line below a naked field key." (save-excursion (forward-line -1) (beginning-of-line) - (looking-at-p (concat snakemake-field-key-indented-re " *$")))) + (looking-at-p (concat snakemake-field-key-indented-re "\\s-*$")))) (defun snakemake-run-field-line-p () "Return non-nil if point is on any line below a run field key. @@ -223,7 +223,7 @@ or subworkflow block." ;; Because of multiline fields, the previous line may not have a ;; key. (let ((rule-re (concat "\\(?:" snakemake-field-key-indented-re - "\\)* *[^ ]"))) + "\\)*\\s-*\\S-"))) (when (re-search-forward rule-re (point-at-eol) t) (1- (current-column)))))) |