aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDmitry Gutov2012-03-21 14:33:07 -0400
committerStefan Monnier2012-03-21 14:33:07 -0400
commit396750161e54b486a1d68a5ecb177bc75f24cbb2 (patch)
tree4e274ae6016a95aeff1ac428af0d062d0a18fa2e
parent0a6934fc04c67dd3f0b1c38f0d25e65d07bd2fec (diff)
downloademacs-396750161e54b486a1d68a5ecb177bc75f24cbb2.tar.gz
emacs-396750161e54b486a1d68a5ecb177bc75f24cbb2.zip
* lisp/progmodes/ruby-mode.el: Don't confuse "end:" for "end".
(ruby-block-end-re, ruby-delimiter, ruby-parse-partial) (ruby-beginning-of-indent): Be more careful with the difference between word-boundary and symbol boundary. (ruby-mode-syntax-table): Make : a symbol constituent. Fixes: debbugs:10786
-rw-r--r--lisp/ChangeLog8
-rw-r--r--lisp/progmodes/ruby-mode.el11
2 files changed, 14 insertions, 5 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 6034680d289..f45cfd3ec57 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,11 @@
12012-03-21 Dmitry Gutov <dgutov@yandex.ru>
2
3 * progmodes/ruby-mode.el: Don't confuse "end:" for "end" (bug#10786).
4 (ruby-block-end-re, ruby-delimiter, ruby-parse-partial)
5 (ruby-beginning-of-indent): Be more careful with the difference
6 between word-boundary and symbol boundary.
7 (ruby-mode-syntax-table): Make : a symbol constituent.
8
12012-03-21 Andreas Politz <politza@fh-trier.de> 92012-03-21 Andreas Politz <politza@fh-trier.de>
2 10
3 * outline.el (outline-flag-region): Evaporate overlays (bug#10789). 11 * outline.el (outline-flag-region): Evaporate overlays (bug#10789).
diff --git a/lisp/progmodes/ruby-mode.el b/lisp/progmodes/ruby-mode.el
index bf264972940..66aa256f947 100644
--- a/lisp/progmodes/ruby-mode.el
+++ b/lisp/progmodes/ruby-mode.el
@@ -96,7 +96,7 @@
96 (regexp-opt (append ruby-modifier-beg-keywords ruby-block-op-keywords)) 96 (regexp-opt (append ruby-modifier-beg-keywords ruby-block-op-keywords))
97 "Regexp to match hanging block modifiers.") 97 "Regexp to match hanging block modifiers.")
98 98
99(defconst ruby-block-end-re "\\<end\\>") 99(defconst ruby-block-end-re "\\_<end\\_>")
100 100
101(eval-and-compile 101(eval-and-compile
102 (defconst ruby-here-doc-beg-re 102 (defconst ruby-here-doc-beg-re
@@ -115,9 +115,9 @@ This should only be called after matching against `ruby-here-doc-beg-re'."
115 (match-string 6))))) 115 (match-string 6)))))
116 116
117(defconst ruby-delimiter 117(defconst ruby-delimiter
118 (concat "[?$/%(){}#\"'`.:]\\|<<\\|\\[\\|\\]\\|\\<\\(" 118 (concat "[?$/%(){}#\"'`.:]\\|<<\\|\\[\\|\\]\\|\\_<\\("
119 ruby-block-beg-re 119 ruby-block-beg-re
120 "\\)\\>\\|" ruby-block-end-re 120 "\\)\\_>\\|" ruby-block-end-re
121 "\\|^=begin\\|" ruby-here-doc-beg-re)) 121 "\\|^=begin\\|" ruby-here-doc-beg-re))
122 122
123(defconst ruby-negative 123(defconst ruby-negative
@@ -166,6 +166,7 @@ This should only be called after matching against `ruby-here-doc-beg-re'."
166 (modify-syntax-entry ?$ "." table) 166 (modify-syntax-entry ?$ "." table)
167 (modify-syntax-entry ?? "_" table) 167 (modify-syntax-entry ?? "_" table)
168 (modify-syntax-entry ?_ "_" table) 168 (modify-syntax-entry ?_ "_" table)
169 (modify-syntax-entry ?: "_" table)
169 (modify-syntax-entry ?< "." table) 170 (modify-syntax-entry ?< "." table)
170 (modify-syntax-entry ?> "." table) 171 (modify-syntax-entry ?> "." table)
171 (modify-syntax-entry ?& "." table) 172 (modify-syntax-entry ?& "." table)
@@ -565,7 +566,7 @@ and `\\' when preceded by `?'."
565 (setq nest (cons (cons nil pnt) nest)) 566 (setq nest (cons (cons nil pnt) nest))
566 (setq depth (1+ depth)))) 567 (setq depth (1+ depth))))
567 (goto-char (match-end 0))) 568 (goto-char (match-end 0)))
568 ((looking-at (concat "\\<\\(" ruby-block-beg-re "\\)\\>")) 569 ((looking-at (concat "\\_<\\(" ruby-block-beg-re "\\)\\_>"))
569 (and 570 (and
570 (save-match-data 571 (save-match-data
571 (or (not (looking-at (concat "do" ruby-keyword-end-re))) 572 (or (not (looking-at (concat "do" ruby-keyword-end-re)))
@@ -864,7 +865,7 @@ move backward."
864 ;; It seems like it should move to the line where indentation should deepen, 865 ;; It seems like it should move to the line where indentation should deepen,
865 ;; but ruby-indent-beg-re only accounts for whitespace before class, module and def, 866 ;; but ruby-indent-beg-re only accounts for whitespace before class, module and def,
866 ;; so this will only match other block beginners at the beginning of the line. 867 ;; so this will only match other block beginners at the beginning of the line.
867 (and (re-search-backward (concat "^\\(" ruby-indent-beg-re "\\)\\b") nil 'move) 868 (and (re-search-backward (concat "^\\(" ruby-indent-beg-re "\\)\\_>") nil 'move)
868 (beginning-of-line))) 869 (beginning-of-line)))
869 870
870(defun ruby-move-to-block (n) 871(defun ruby-move-to-block (n)