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

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

bug#35644: closed (emacs module support doesn't work)


From: GNU bug Tracking System
Subject: bug#35644: closed (emacs module support doesn't work)
Date: Fri, 20 Mar 2020 19:07:02 +0000

Your message dated Fri, 20 Mar 2020 20:06:17 +0100
with message-id <address@hidden>
and subject line Re: bug#35644: emacs module support doesn't work
has caused the debbugs.gnu.org bug report #35644,
regarding emacs module support doesn't work
to be marked as done.

(If you believe you have received this mail in error, please contact
address@hidden.)


-- 
35644: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=35644
GNU Bug Tracking System
Contact address@hidden with problems
--- Begin Message --- Subject: emacs module support doesn't work Date: Wed, 08 May 2019 21:16:48 -0500 User-agent: Gnus/5.13 (Gnus v5.13) Emacs/26.2 (gnu/linux)
While attempting to package libegit2
(https://github.com/magit/libegit2), I found that any attempt at loading
a dynamic module from emacs would seemingly work (it returns t), but not
actually work: no module api functions invoked from C seem to have any
effect, including defining functions and printing messages. Here's an
example


-------------------------------
#include <stdio.h>
#include <stdlib.h>
#include <emacs-module.h>

int plugin_is_GPL_compatible;

static emacs_value
hello(emacs_env *env, ptrdiff_t nargs, emacs_value args[], void *data)
{
        const char str[] = "Hello Emacs";
        return env->make_string(env, str, sizeof(str) - 1);
}

/* Module init function.  */
int
emacs_module_init(struct emacs_runtime *ert)
{
        emacs_env *env = ert->get_environment(ert);

        emacs_value hellofn = env->make_function(env, 0, 0, hello, "return 
hello string", NULL);

        // Bind NAME to FUN.
        // (defalias 'hello-c '(lambda () "Hello Emacs"))
        emacs_value defalias_sym = env->intern(env, "defalias");
        emacs_value hello_sym = env->intern(env, "hello-c");
        emacs_value defalias_args[] = { hello_sym, hellofn };

        env->funcall(env, defalias_sym, 2, defalias_args);

        // Provide FEATURE to Emacs.
        // (provide 'hello-core)
        emacs_value feature_sym = env->intern(env, "hello-module");
        emacs_value provide_sym = env->intern(env, "provide");
        emacs_value provide_args[] = { feature_sym };

        env->funcall(env, provide_sym, 1, provide_args);

        char message[] = "TEST MESSAGE!";
        emacs_value message_str = env->make_string(env, message, 
sizeof(message) - 1);
        emacs_value message_sym = env->intern(env, "message");
        emacs_value message_args[] = {message_str};

        // spam a bit just to be sure
        env->funcall(env, message_sym, 1, message_args);
        env->funcall(env, message_sym, 1, message_args);
        env->funcall(env, message_sym, 1, message_args);

        return 0;
}
-------------------------------

Assuming the above file is named emacs-module-test.c:

-------------------------------
$ gcc -fPIC -shared emacs-module-test.c -o hello-module.so
$ emacs -Q -L . --batch -l hello-module --eval "(message (hello-c))"

=> Symbol's function definition is void: hello-c
-------------------------------

As far as I can tell, this should work. Our emacs is built with
'--with-modules', and 'MODULES' is in system-configuration-features. Any
idea what's going wrong?

- reepca



--- End Message ---
--- Begin Message --- Subject: Re: bug#35644: emacs module support doesn't work Date: Fri, 20 Mar 2020 20:06:17 +0100 User-agent: Notmuch/0.29.3 (https://notmuchmail.org) Emacs/26.3 (x86_64-pc-linux-gnu)
Caleb Ristvedt <address@hidden> writes:

> I can confirm that it now works. I did a bit of looking through the commit
> history and playing around with 'guix time-machine', and whatever changed
> to fix
> it, it wasn't a change that touched gnu/packages/emacs.scm. I know it fell
> between 7ab5c4e0e8 and 5ce153b110, though.
>
> Thanks for bringing this up, I guess we can close this now?

Thank you both for the report and investigation.  Closing!

Attachment: signature.asc
Description: PGP signature


--- End Message ---

reply via email to

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