branch: externals/ruby-end commit 9f0caf41d65fe1477f8ce54c258b8c26528593c8 Author: Johan Andersson <johan.rej...@gmail.com> Commit: Johan Andersson <johan.rej...@gmail.com>
Update regular expressions for matching expansion. --- ruby-end.el | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/ruby-end.el b/ruby-end.el index ea2b3408d3..62e1f4becb 100644 --- a/ruby-end.el +++ b/ruby-end.el @@ -56,9 +56,13 @@ map) "Keymap for `ruby-end-mode'.") -(defvar ruby-end-keywords-re +(defconst ruby-end-expand-before-re "\\(?:^\\|\\s-+\\)\\(?:def\\|if\\|class\\|module\\|unless\\|case\\|while\\|do\\|until\\|for\\|begin\\)" - "Regular expression matching from point and backwards a valid keyword.") + "Regular expression matching before point.") + +(defconst ruby-end-expand-after-re + "\\s-*$" + "Regular expression matching after point.") (defun ruby-end-space () "Called when SPC-key is pressed." @@ -90,8 +94,8 @@ "Checks if expansion (insertion of end) should be done." (and (ruby-end-code-at-point-p) - (looking-back ruby-end-keywords-re) - (looking-at "\\s-*$"))) + (looking-back ruby-end-expand-before-re) + (looking-at ruby-end-expand-after-re))) (defun ruby-end-code-at-point-p () "Checks if point is code, or comment or string."