From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Dmitry Gutov Newsgroups: gmane.emacs.bugs Subject: bug#6286: General delimited literals in ruby-mode patch Date: Thu, 03 May 2012 09:39:40 +0400 Message-ID: <4FA21A1C.8040907@yandex.ru> References: <8739ammd8l.fsf@yandex.ru> <87k43vecyt.fsf@yandex.ru> <4F973B73.1000808@yandex.ru> <4F981DEA.6060700@yandex.ru> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="------------030107000209060203020408" X-Trace: dough.gmane.org 1336023634 6643 80.91.229.3 (3 May 2012 05:40:34 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Thu, 3 May 2012 05:40:34 +0000 (UTC) Cc: 6286@debbugs.gnu.org To: Stefan Monnier Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Thu May 03 07:40:33 2012 Return-path: Envelope-to: geb-bug-gnu-emacs@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 1SPomG-0008An-Qz for geb-bug-gnu-emacs@m.gmane.org; Thu, 03 May 2012 07:40:33 +0200 Original-Received: from localhost ([::1]:39534 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SPomG-0003tH-52 for geb-bug-gnu-emacs@m.gmane.org; Thu, 03 May 2012 01:40:32 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:49895) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SPomC-0003t1-UE for bug-gnu-emacs@gnu.org; Thu, 03 May 2012 01:40:30 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SPomB-0001Zd-1Y for bug-gnu-emacs@gnu.org; Thu, 03 May 2012 01:40:28 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:33361) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SPomA-0001ZS-N7 for bug-gnu-emacs@gnu.org; Thu, 03 May 2012 01:40:26 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.72) (envelope-from ) id 1SPoni-0002qp-8C for bug-gnu-emacs@gnu.org; Thu, 03 May 2012 01:42:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Dmitry Gutov Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 03 May 2012 05:42:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 6286 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 6286-submit@debbugs.gnu.org id=B6286.133602369610922 (code B ref 6286); Thu, 03 May 2012 05:42:02 +0000 Original-Received: (at 6286) by debbugs.gnu.org; 3 May 2012 05:41:36 +0000 Original-Received: from localhost ([127.0.0.1]:34395 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1SPonH-0002q6-Ng for submit@debbugs.gnu.org; Thu, 03 May 2012 01:41:36 -0400 Original-Received: from forward20.mail.yandex.net ([95.108.253.145]:45761) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1SPonE-0002pm-Au for 6286@debbugs.gnu.org; Thu, 03 May 2012 01:41:34 -0400 Original-Received: from smtp19.mail.yandex.net (smtp19.mail.yandex.net [95.108.252.19]) by forward20.mail.yandex.net (Yandex) with ESMTP id 44019104179C; Thu, 3 May 2012 09:39:49 +0400 (MSK) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yandex.ru; s=mail; t=1336023589; bh=XiMn5mDjUSQB5yvFum/COm0hiYDqI1bwloQessfFqDs=; h=Message-ID:Date:From:MIME-Version:To:CC:Subject:References: In-Reply-To:Content-Type; b=B2XctxpQdSQ15diW01/kH5PxnTaagmCfqeMwpMo0r4+zQUSnfgPuhGvMs6MwX95aR tVSRkdkidZqv2Q1vm+yqn/arL+EWi/dOaMh+Dza5Ls66e+QkBxaMx7VZmcpJuopkQB d8MXnAjVcxdciIff1aYYdfbFcq8d03lrnJRB5VFQ= Original-Received: from smtp19.mail.yandex.net (localhost [127.0.0.1]) by smtp19.mail.yandex.net (Yandex) with ESMTP id 203BEBE0193; Thu, 3 May 2012 09:39:49 +0400 (MSK) Original-Received: from 98-87.nwlink.spb.ru (98-87.nwlink.spb.ru [178.252.98.87]) by smtp19.mail.yandex.net (nwsmtp/Yandex) with ESMTP id daRmE2Lb-daRCmWIh; Thu, 3 May 2012 09:39:36 +0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yandex.ru; s=mail; t=1336023589; bh=XiMn5mDjUSQB5yvFum/COm0hiYDqI1bwloQessfFqDs=; h=Message-ID:Date:From:User-Agent:MIME-Version:To:CC:Subject: References:In-Reply-To:Content-Type; b=FKiXfzy0XNOr91iSipVE+OPp7lKJsDjD1Jn1sKw7pX34AOkX1eMsRSlCLS3kyEORJ Dh+j6z2FtQjmXokC85ZSqpvPMXfofb/FhLIw26bwNmAPaH6KbdQSDQKLGWl8J2TFsv qeDyWBOk8xGuovLw/ME+yU0krawDX+htjQLFOJBY= User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:12.0) Gecko/20120428 Thunderbird/12.0.1 In-Reply-To: X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) X-Received-From: 140.186.70.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:59717 Archived-At: This is a multi-part message in MIME format. --------------030107000209060203020408 Content-Type: text/plain; charset=windows-1251; format=flowed Content-Transfer-Encoding: 7bit Hi again, I missed the byte compilation error, arising from the fact that `syntax-propertize-rules` evaluates regular expressions at compile time. Options: 1) Remove customizability (see attached patch). 2) Regexp matches any method, then we check against the whitelist in a new function. -- Dmitry --------------030107000209060203020408 Content-Type: text/plain; charset=windows-1251; name="0003-lisp-progmodes-ruby-mode.el-Fix-byte-compilation-err.patch" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename*0="0003-lisp-progmodes-ruby-mode.el-Fix-byte-compilation-err.pa"; filename*1="tch" >From bb9ffe72bcb874aec06ca06b62576af8eca5f9f2 Mon Sep 17 00:00:00 2001 From: Dmitry Gutov Date: Thu, 3 May 2012 09:11:20 +0400 Subject: [PATCH 3/3] * lisp/progmodes/ruby-mode.el: Fix byte compilation error ruby-syntax-methods-before-regexp: make constant ruby-syntax-methods-before-regexp, ruby-percent-literal-beg-re: wrap together in (eval-and-compile) --- lisp/progmodes/ruby-mode.el | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/lisp/progmodes/ruby-mode.el b/lisp/progmodes/ruby-mode.el index 14ce846..15c8246 100644 --- a/lisp/progmodes/ruby-mode.el +++ b/lisp/progmodes/ruby-mode.el @@ -226,13 +226,6 @@ Also ignores spaces after parenthesis when 'space." "Use `ruby-encoding-map' to set encoding magic comment if this is non-nil." :type 'boolean :group 'ruby) -(defcustom ruby-syntax-methods-before-regexp - '("gsub" "gsub!" "sub" "sub!" "scan" "split" "split!" "index" "match" - "assert_match" "Given" "Then" "When") - "Methods that can take regexp as the first argument. -It will be properly highlighted even when the call omits parens." - :group 'ruby) - ;; Safe file variables (put 'ruby-indent-tabs-mode 'safe-local-variable 'booleanp) (put 'ruby-indent-level 'safe-local-variable 'integerp) @@ -1124,9 +1117,16 @@ See `add-log-current-defun-function'." (if (eval-when-compile (fboundp #'syntax-propertize-rules)) ;; New code that works independently from font-lock. (progn - (defconst ruby-percent-literal-beg-re - "\\(%\\)[qQrswWx]?\\([[:punct:]]\\)" - "Regexp to match the beginning of percent literal.") + (eval-and-compile + (defconst ruby-percent-literal-beg-re + "\\(%\\)[qQrswWx]?\\([[:punct:]]\\)" + "Regexp to match the beginning of percent literal.") + + (defconst ruby-syntax-methods-before-regexp + '("gsub" "gsub!" "sub" "sub!" "scan" "split" "split!" "index" "match" + "assert_match" "Given" "Then" "When") + "Methods that can take regexp as the first argument. +It will be properly highlighted even when the call omits parens.")) (defun ruby-syntax-propertize-function (start end) "Syntactic keywords for Ruby mode. See `syntax-propertize-function'." -- 1.7.10.msysgit.1 --------------030107000209060203020408--