From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Dmitry Gutov Newsgroups: gmane.emacs.devel Subject: Re: Small improvements to ruby-mode Date: Wed, 03 Jul 2013 19:46:50 +0400 Message-ID: <51D4476A.40107@yandex.ru> References: <2A6700DEDCA640EF92B326002717596D@gmail.com> <87txkrm46t.fsf@yandex.ru> <6EF2AEF8D67840A2AF1C908AA3D0725F@gmail.com> <51C5A67A.2020002@yandex.ru> <51C6EA5F.2040408@yandex.ru> <51D1CB5A.2060900@yandex.ru> <51D1F98D.3060900@yandex.ru> <51D31E12.7060002@yandex.ru> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Trace: ger.gmane.org 1372866419 16857 80.91.229.3 (3 Jul 2013 15:46:59 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 3 Jul 2013 15:46:59 +0000 (UTC) Cc: emacs-devel To: Bozhidar Batsov Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Wed Jul 03 17:46:59 2013 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1UuPGl-0002bh-B4 for ged-emacs-devel@m.gmane.org; Wed, 03 Jul 2013 17:46:59 +0200 Original-Received: from localhost ([::1]:60562 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UuPGk-0008Dv-Uh for ged-emacs-devel@m.gmane.org; Wed, 03 Jul 2013 11:46:58 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:59429) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UuPGd-000853-0q for emacs-devel@gnu.org; Wed, 03 Jul 2013 11:46:55 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UuPGX-0004pI-9e for emacs-devel@gnu.org; Wed, 03 Jul 2013 11:46:50 -0400 Original-Received: from mail-la0-x231.google.com ([2a00:1450:4010:c03::231]:44246) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UuPGW-0004p5-VZ for emacs-devel@gnu.org; Wed, 03 Jul 2013 11:46:45 -0400 Original-Received: by mail-la0-f49.google.com with SMTP id ea20so285400lab.36 for ; Wed, 03 Jul 2013 08:46:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:message-id:date:from:user-agent:mime-version:to:cc:subject :references:in-reply-to:content-type:content-transfer-encoding :x-antivirus:x-antivirus-status; bh=CyQJsCbBzUs+VDl2Uz/OucjrLVxgYfJhK85s2o4GhnA=; b=E/e64/A05Mh5CoJq0FAEtf+t/Urno57bDX090dG+WEqn1YqirqPn5ocMlEL6WMfzVs 4qo0ELfy4WqeTi/tEfpCwFps1p1wAaNn3zI8P9J+uojk0y+5loRCDPtfxLdinekgZ9n8 qxd2SSw7giH3nULAQ6wziCeg/vvKsnpK2M4Y66cwTCLxcCoZJzKO8OQJ6EWv3NI0m+lm LpgyoOnZjqjYqa/V2N9gMu6TIVHBoL2gKgBFzQP1TMXwumYtg27gEZoc6Y4ubr8CAZNg sS1daXLVdSA12WjltellMbFp7IZUPktj4iJYDi47rk0I4vYUEHwOCamKZLc9f6Mv1+Nq R+9Q== X-Received: by 10.112.167.136 with SMTP id zo8mr1508134lbb.33.1372866403962; Wed, 03 Jul 2013 08:46:43 -0700 (PDT) Original-Received: from [127.0.0.1] ([178.252.98.87]) by mx.google.com with ESMTPSA id w9sm10779965lbk.7.2013.07.03.08.46.42 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 03 Jul 2013 08:46:43 -0700 (PDT) User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:17.0) Gecko/20130620 Thunderbird/17.0.7 In-Reply-To: <51D31E12.7060002@yandex.ru> X-Antivirus: avast! (VPS 130702-1, 03.07.2013), Outbound message X-Antivirus-Status: Clean X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2a00:1450:4010:c03::231 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:161481 Archived-At: On 02.07.2013 22:38, Dmitry Gutov wrote: > Putting the cursor on one of the 4 lines after "elsif" in the second > example and pressing `C-M-p' moves it to the "add_offence" line. > > And pressing `C-M-n' after that moves it to the "end" closing the > "operands.each" block. > > Pressing `C-M-p' or `C-M-n' on the `elsif' line misbehaves similarly. I've fixed the last one and left the other two in. For the most part, they're intentional, since we're not supposed to stop at "elsif" (it's not beginning or end of a block, after all). As far as the keywords go, I've checked in the following patch: === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2013-07-03 03:20:04 +0000 +++ lisp/ChangeLog 2013-07-03 15:45:17 +0000 @@ -1,3 +1,8 @@ +2013-07-03 Dmitry Gutov + + * progmodes/ruby-mode.el (ruby-font-lock-keywords): Highlight more + keywords and built-ins. + 2013-07-03 Glenn Morris * subr.el (y-or-n-p): Handle empty prompts. (Bug#14770) === modified file 'lisp/progmodes/ruby-mode.el' --- lisp/progmodes/ruby-mode.el 2013-07-03 01:02:18 +0000 +++ lisp/progmodes/ruby-mode.el 2013-07-03 15:36:27 +0000 @@ -1762,31 +1762,67 @@ "yield") 'symbols) "\\|" - ;; keyword-like methods on Kernel and Module (regexp-opt - '("alias_method" + ;; 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" + "load" + "loop" + "open" + "p" + "print" + "printf" + "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 + "alias_method" "autoload" "attr" "attr_accessor" "attr_reader" "attr_writer" - "catch" "define_method" "extend" - "fail" "include" - "lambda" - "loop" "module_function" + "prepend" "private" - "proc" "protected" "public" - "raise" "refine" - "require" - "require_relative" - "throw" "using") 'symbols) "\\)") @@ -1794,12 +1830,16 @@ '(if (match-beginning 4) font-lock-builtin-face font-lock-keyword-face)) + ;; Perl-ish keywords + "\\_<\\(?:BEGIN\\|END\\)\\_>\\|^__END__$" ;; here-doc beginnings `(,ruby-here-doc-beg-re 0 (unless (ruby-singleton-class-p (match-beginning 0)) 'font-lock-string-face)) ;; variables '("\\(^\\|[^.@$]\\|\\.\\.\\)\\_<\\(nil\\|self\\|true\\|false\\)\\>" 2 font-lock-variable-name-face) + ;; keywords that evaluate to certain values + '("\\_<__\\(?:LINE\\|ENCODING\\|FILE\\)__\\_>" 0 font-lock-variable-name-face) ;; symbols '("\\(^\\|[^:]\\)\\(:\\([-+~]@?\\|[/%&|^`]\\|\\*\\*?\\|<\\(<\\|=>?\\)?\\|>[>=]?\\|===?\\|=~\\|![~=]?\\|\\[\\]=?\\|@?\\(\\w\\|_\\)+\\([!?=]\\|\\b_*\\)\\|#{[^}\n\\\\]*\\(\\\\.[^}\n\\\\]*\\)*}\\)\\)" 2 font-lock-constant-face)