Skip to content

Commit

Permalink
[Fix emacs-ess#277] Better regex boundaries for prefixed blocks
Browse files Browse the repository at this point in the history
  • Loading branch information
lionel- committed Nov 30, 2015
1 parent a78e745 commit 9cf747e
Show file tree
Hide file tree
Showing 7 changed files with 39 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lisp/ess-r-syntax.el
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,7 @@ into account."
(ess-climb-block-prefix)))))))

(defvar ess-prefixed-block-patterns
(mapcar (lambda (fun) (concat fun "\\b"))
(mapcar (lambda (fun) (concat fun "[ \t\n]*("))
'("function" "if" "for" "while")))

(defun ess-looking-at-prefixed-block-p (&optional call)
Expand Down
18 changes: 18 additions & 0 deletions test/literate/syntax.R
Original file line number Diff line number Diff line change
Expand Up @@ -36,3 +36,21 @@ text ¶# comment
##! (ess-climb-continuations)

!stuff1 || stuff2)


##### Bare blocks

### 1 ----------------------------------------------------------------

function_call()

##! (ess-climb-block-prefix)

function_call()

##! (ess-climb-block-prefix "function")

function_call()
4 changes: 4 additions & 0 deletions test/styles/C++.R
Original file line number Diff line number Diff line change
Expand Up @@ -465,6 +465,10 @@ fun_call(argument,
}
}

## 22
function_call()
stuff


### Bracket indexing

Expand Down
4 changes: 4 additions & 0 deletions test/styles/RRR+.R
Original file line number Diff line number Diff line change
Expand Up @@ -465,6 +465,10 @@ fun_call(argument,
}
}

## 22
function_call()
stuff


### Bracket indexing

Expand Down
4 changes: 4 additions & 0 deletions test/styles/RRR.R
Original file line number Diff line number Diff line change
Expand Up @@ -465,6 +465,10 @@ fun_call(argument,
}
}

## 22
function_call()
stuff


### Bracket indexing

Expand Down
4 changes: 4 additions & 0 deletions test/styles/RStudio-.R
Original file line number Diff line number Diff line change
Expand Up @@ -465,6 +465,10 @@ fun_call(argument,
}
}

## 22
function_call()
stuff


### Bracket indexing

Expand Down
4 changes: 4 additions & 0 deletions test/styles/misc1.R
Original file line number Diff line number Diff line change
Expand Up @@ -465,6 +465,10 @@ fun_call(argument,
}
}

## 22
function_call()
stuff


### Bracket indexing

Expand Down

0 comments on commit 9cf747e

Please sign in to comment.