On 05/05/2015 09:11 PM, Stephen Leake wrote: > Stephen Leake writes: > >> Aurélien Aptel writes: >> >>> I've tried to implement modules using Daniel's plan. It turned out to >>> be pretty easy, mostly because I'm more familiar with the Emacs >>> codebase now and because it's a lot less intrusive than my previous >>> attempt. >>> >>> It's not finished but I have a basic module working on linux. It's a >>> proof of concept, basically. >> >> I've implemented a test module that calls two Ada mode parser actions >> (see below). >> >> The real module will call the actual parser and build the action args >> from the parse results. >> >> I did not have to modify anything in the Emacs C code to make this work, >> so it shows this module design is adquate for my use case so far. > > I've made more progress; I've got a module that should run the full Ada > parser on a buffer. > > However, when I run it, it crashes on a call like: > > emacs_value goto_char_sym = env.intern (env, "goto-char"); > env.funcall (env, goto_char_sym, env.make_fixnum (env, 1)); > > When I trace the 'funcall' (in eval.c DEFUN funcall), it hits this code: > > fun = original_fun; > if (SYMBOLP (fun) && !NILP (fun) > && (fun = XSYMBOL (fun)->function, SYMBOLP (fun))) > fun = indirect_function (fun); > > and sets fun to 0, which then signals a failure. > > Is this because 'goto-char' is implemented in C? That's odd. Why would it matter? For me, (symbol-function 'goto-char) is a subr, so the second SYMBOLP above should fail and `fun' should be a subr object, not nil.