bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#13605: 24.3.50; Eager macro-expansion failure: (void-variable ruby-s


From: Stefan Monnier
Subject: 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
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux)

> 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)






reply via email to

[Prev in Thread] Current Thread [Next in Thread]