From: Dmitry Gutov Date: Sat, 1 Feb 2014 17:06:08 +0000 (+0200) Subject: Fix bug#16610 X-Git-Tag: emacs-24.3.90~173^2^2~42^2~45^2~202 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=68e004e0cd5b4aeed339e08a103e6b060b93cae2;p=emacs.git Fix bug#16610 * lisp/progmodes/ruby-mode.el (ruby-font-lock-keywords): For built-ins that require arguments, check that they're followed by something that looks like argument. --- diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 4903bfdd1d9..b2adc2cf881 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -4,6 +4,9 @@ `:' before binary operators (bug#16609). Don't check for `:' before `[' and `(', or their syntax status. A percent literal can't end with either. + (ruby-font-lock-keywords): For built-ins that require arguments, + check that they're followed by something that looks like argument + (bug#16610). 2014-02-01 Lars Ingebrigtsen diff --git a/lisp/progmodes/ruby-mode.el b/lisp/progmodes/ruby-mode.el index 5cee77b29a5..22de9a83f2b 100644 --- a/lisp/progmodes/ruby-mode.el +++ b/lisp/progmodes/ruby-mode.el @@ -2017,27 +2017,17 @@ See `font-lock-syntax-table'.") "yield") 'symbols)) (1 font-lock-keyword-face)) - ;; Some core methods. + ;; Core methods that have required arguments. (,(concat ruby-font-lock-keyword-beg-re (regexp-opt '( ;; built-in methods on Kernel - "__callee__" - "__dir__" - "__method__" - "abort" "at_exit" "autoload" "autoload?" - "binding" - "block_given?" - "caller" "catch" "eval" "exec" - "exit" - "exit!" - "fail" "fork" "format" "lambda" @@ -2050,19 +2040,12 @@ See `font-lock-syntax-table'.") "proc" "putc" "puts" - "raise" - "rand" - "readline" - "readlines" "require" "require_relative" - "sleep" "spawn" "sprintf" - "srand" "syscall" "system" - "throw" "trap" "warn" ;; keyword-like private methods on Module @@ -2082,6 +2065,31 @@ See `font-lock-syntax-table'.") "refine" "using") 'symbols)) + (1 (unless (looking-at " *\\(?:[]|,.)}]\\|$\\)") + font-lock-builtin-face))) + ;; Kernel methods that have no required arguments. + (,(concat + ruby-font-lock-keyword-beg-re + (regexp-opt + '("__callee__" + "__dir__" + "__method__" + "abort" + "at_exit" + "binding" + "block_given?" + "caller" + "exit" + "exit!" + "fail" + "raise" + "rand" + "readline" + "readlines" + "sleep" + "srand" + "throw") + 'symbols)) (1 font-lock-builtin-face)) ;; Here-doc beginnings. (,ruby-here-doc-beg-re