GNU bug report logs - #13605
24.3.50; Eager macro-expansion failure: (void-variable ruby-syntax-methods-before-regexp) when ruby-mode is not compiled

Previous Next

Package: emacs;

Reported by: Dmitry Gutov <dgutov <at> yandex.ru>

Date: Fri, 1 Feb 2013 21:37:02 UTC

Severity: normal

Found in version 24.3.50

Done: Stefan Monnier <monnier <at> iro.umontreal.ca>

Bug is archived. No further changes may be made.

Full log


Message #8 received at 13605 <at> debbugs.gnu.org (full text, mbox):

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: Dmitry Gutov <dgutov <at> yandex.ru>
Cc: 13605 <at> debbugs.gnu.org
Subject: Re: bug#13605: 24.3.50; Eager macro-expansion failure: (void-variable
	ruby-syntax-methods-before-regexp) when ruby-mode is not compiled
Date: Fri, 01 Feb 2013 18:30:31 -0500
> The constant in question is defined in an `eval-and-compile' block, I
> can't see what else could the interpreter need. Help?

Eager macro expansion works at the granularity of top-level expressions,
so the whole (if (eval-when-compile (fboundp #'syntax-propertize-rules)) ...)
block is macro-expanded before it gets run.

The patch below should work around the problem (probably best option
for emacs-24).

Maybe the better way to fix it (for trunk) is to change eval-and-compile
(and probably eval-when-compile) so that it evaluates its argument during
macro-expansion.


        Stefan


=== modified file 'lisp/progmodes/ruby-mode.el'
--- lisp/progmodes/ruby-mode.el	2013-01-28 02:07:42 +0000
+++ lisp/progmodes/ruby-mode.el	2013-02-01 23:24:39 +0000
@@ -1211,10 +1211,8 @@
 (declare-function ruby-syntax-enclosing-percent-literal "ruby-mode" (limit))
 (declare-function ruby-syntax-propertize-percent-literal "ruby-mode" (limit))
 
-(if (eval-when-compile (fboundp #'syntax-propertize-rules))
-    ;; New code that works independently from font-lock.
-    (progn
-      (eval-and-compile
+
+(eval-and-compile
         (defconst ruby-percent-literal-beg-re
           "\\(%\\)[qQrswWx]?\\([[:punct:]]\\)"
           "Regexp to match the beginning of percent literal.")
@@ -1225,6 +1223,10 @@
           "Methods that can take regexp as the first argument.
 It will be properly highlighted even when the call omits parens."))
 
+(if (eval-when-compile (fboundp #'syntax-propertize-rules))
+    ;; New code that works independently from font-lock.
+    (progn
+
       (defun ruby-syntax-propertize-function (start end)
         "Syntactic keywords for Ruby mode.  See `syntax-propertize-function'."
         (goto-char start)





This bug report was last modified 12 years and 108 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.