aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDmitry Gutov2014-03-02 00:04:59 +0200
committerDmitry Gutov2014-03-02 00:04:59 +0200
commit1850913d96126ca52c8dc5beadc82b004477b0cf (patch)
treea58960a79f1af8ba2ad6148a6212cee8e3097405
parent2907acd464d055256efb84afb0a8c978befa8bc6 (diff)
downloademacs-1850913d96126ca52c8dc5beadc82b004477b0cf.tar.gz
emacs-1850913d96126ca52c8dc5beadc82b004477b0cf.zip
* lisp/progmodes/ruby-mode.el (ruby-font-lock-keywords): Highlight
regexp options. Fixes: debbugs:16914
-rw-r--r--lisp/ChangeLog5
-rw-r--r--lisp/progmodes/ruby-mode.el10
-rw-r--r--test/indent/ruby.rb4
3 files changed, 19 insertions, 0 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index d3419412ebe..d25f877a644 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,8 @@
12014-03-01 Dmitry Gutov <dgutov@yandex.ru>
2
3 * progmodes/ruby-mode.el (ruby-font-lock-keywords): Highlight
4 regexp options. (Bug#16914)
5
12014-03-01 Martin Rudalics <rudalics@gmx.at> 62014-03-01 Martin Rudalics <rudalics@gmx.at>
2 7
3 * window.el (window--max-delta-1): Round down when calculating 8 * window.el (window--max-delta-1): Round down when calculating
diff --git a/lisp/progmodes/ruby-mode.el b/lisp/progmodes/ruby-mode.el
index 5cd054a22a8..a5d8285c98e 100644
--- a/lisp/progmodes/ruby-mode.el
+++ b/lisp/progmodes/ruby-mode.el
@@ -2132,6 +2132,16 @@ See `font-lock-syntax-table'.")
2132 ;; Character literals. 2132 ;; Character literals.
2133 ;; FIXME: Support longer escape sequences. 2133 ;; FIXME: Support longer escape sequences.
2134 ("\\_<\\?\\\\?\\S " 0 font-lock-string-face) 2134 ("\\_<\\?\\\\?\\S " 0 font-lock-string-face)
2135 ;; Regexp options.
2136 ("\\(?:\\s|\\|/\\)\\([imxo]+\\)"
2137 1 (when (save-excursion
2138 (let ((state (syntax-ppss (match-beginning 0))))
2139 (and (nth 3 state)
2140 (or (eq (char-after) ?/)
2141 (progn
2142 (goto-char (nth 8 state))
2143 (looking-at "%r"))))))
2144 font-lock-preprocessor-face))
2135 ) 2145 )
2136 "Additional expressions to highlight in Ruby mode.") 2146 "Additional expressions to highlight in Ruby mode.")
2137 2147
diff --git a/test/indent/ruby.rb b/test/indent/ruby.rb
index daec1c30c69..2ca0e482797 100644
--- a/test/indent/ruby.rb
+++ b/test/indent/ruby.rb
@@ -29,6 +29,10 @@ a = asub / aslb + bsub / bslb;
29# Highlight the regexp after "if". 29# Highlight the regexp after "if".
30x = toto / foo if /do bar/ =~ "dobar" 30x = toto / foo if /do bar/ =~ "dobar"
31 31
32# Regexp options are highlighted.
33
34/foo/xi != %r{bar}mo.tee
35
32bar(class: XXX) do # ruby-indent-keyword-label 36bar(class: XXX) do # ruby-indent-keyword-label
33 foo 37 foo
34end 38end