unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Dmitry Gutov <dgutov@yandex.ru>
To: Stefan Monnier <monnier@iro.umontreal.ca>
Cc: 6286@debbugs.gnu.org
Subject: bug#6286: General delimited literals in ruby-mode patch
Date: Thu, 03 May 2012 09:39:40 +0400	[thread overview]
Message-ID: <4FA21A1C.8040907@yandex.ru> (raw)
In-Reply-To: <jwv4ns7iubj.fsf-monnier+emacs@gnu.org>

[-- Attachment #1: Type: text/plain, Size: 304 bytes --]

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

[-- Attachment #2: 0003-lisp-progmodes-ruby-mode.el-Fix-byte-compilation-err.patch --]
[-- Type: text/plain, Size: 2302 bytes --]

From bb9ffe72bcb874aec06ca06b62576af8eca5f9f2 Mon Sep 17 00:00:00 2001
From: Dmitry Gutov <dgutov@yandex.ru>
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


  parent reply	other threads:[~2012-05-03  5:39 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <8739ammd8l.fsf@yandex.ru>
     [not found] ` <87k43vecyt.fsf@yandex.ru>
2012-04-24 15:43   ` bug#6286: General delimited literals in ruby-mode patch Stefan Monnier
2012-04-24 23:46     ` Dmitry Gutov
2012-04-25 14:15       ` Stefan Monnier
     [not found]         ` <4F981DEA.6060700@yandex.ru>
     [not found]           ` <jwv4ns7iubj.fsf-monnier+emacs@gnu.org>
2012-04-28 20:20             ` Dmitry Gutov
2012-05-03  5:39             ` Dmitry Gutov [this message]
2012-08-14  3:56               ` Dmitry Gutov
2012-08-14 12:40                 ` Stefan Monnier
2012-08-14 17:46                   ` Dmitry Gutov
2012-08-15  2:33                     ` Stefan Monnier
     [not found]   ` <87ehu3mga2.fsf@yandex.ru>
2012-04-24 17:09     ` Stefan Monnier
2012-04-25  3:03       ` Dmitry Gutov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4FA21A1C.8040907@yandex.ru \
    --to=dgutov@yandex.ru \
    --cc=6286@debbugs.gnu.org \
    --cc=monnier@iro.umontreal.ca \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).