emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] trunk r116626: * lisp/progmodes/ruby-mode.el (ruby-font-lo


From: Dmitry Gutov
Subject: [Emacs-diffs] trunk r116626: * lisp/progmodes/ruby-mode.el (ruby-font-lock-keywords): Highlight
Date: Sat, 01 Mar 2014 22:05:09 +0000
User-agent: Bazaar (2.6b2)

------------------------------------------------------------
revno: 116626
revision-id: address@hidden
parent: address@hidden
fixes bug: http://debbugs.gnu.org/16914
committer: Dmitry Gutov <address@hidden>
branch nick: trunk
timestamp: Sun 2014-03-02 00:04:59 +0200
message:
  * lisp/progmodes/ruby-mode.el (ruby-font-lock-keywords): Highlight
  regexp options.
modified:
  lisp/ChangeLog                 changelog-20091113204419-o5vbwnq5f7feedwu-1432
  lisp/progmodes/ruby-mode.el    
rubymode.el-20091113204419-o5vbwnq5f7feedwu-8804
  test/indent/ruby.rb            ruby.rb-20120424165921-h044139hbrd7snvw-1
=== modified file 'lisp/ChangeLog'
--- a/lisp/ChangeLog    2014-03-01 11:11:13 +0000
+++ b/lisp/ChangeLog    2014-03-01 22:04:59 +0000
@@ -1,3 +1,8 @@
+2014-03-01  Dmitry Gutov  <address@hidden>
+
+       * progmodes/ruby-mode.el (ruby-font-lock-keywords): Highlight
+       regexp options.  (Bug#16914)
+
 2014-03-01  Martin Rudalics  <address@hidden>
 
        * window.el (window--max-delta-1): Round down when calculating

=== modified file 'lisp/progmodes/ruby-mode.el'
--- a/lisp/progmodes/ruby-mode.el       2014-02-23 08:26:40 +0000
+++ b/lisp/progmodes/ruby-mode.el       2014-03-01 22:04:59 +0000
@@ -2132,6 +2132,16 @@
     ;; Character literals.
     ;; FIXME: Support longer escape sequences.
     ("\\_<\\?\\\\?\\S " 0 font-lock-string-face)
+    ;; Regexp options.
+    ("\\(?:\\s|\\|/\\)\\([imxo]+\\)"
+     1 (when (save-excursion
+               (let ((state (syntax-ppss (match-beginning 0))))
+                 (and (nth 3 state)
+                      (or (eq (char-after) ?/)
+                          (progn
+                            (goto-char (nth 8 state))
+                            (looking-at "%r"))))))
+         font-lock-preprocessor-face))
     )
   "Additional expressions to highlight in Ruby mode.")
 

=== modified file 'test/indent/ruby.rb'
--- a/test/indent/ruby.rb       2014-02-25 18:40:54 +0000
+++ b/test/indent/ruby.rb       2014-03-01 22:04:59 +0000
@@ -29,6 +29,10 @@
 # Highlight the regexp after "if".
 x = toto / foo if /do bar/ =~ "dobar"
 
+# Regexp options are highlighted.
+
+/foo/xi != %r{bar}mo.tee
+
 bar(class: XXX) do              # ruby-indent-keyword-label
   foo
 end


reply via email to

[Prev in Thread] Current Thread [Next in Thread]