// this file: // https://dataswamp.org/~incal/emacs-init/more/dm/dm.c #include "dm.h" #include #include int plugin_is_GPL_compatible; int emacs_module_init(struct emacs_runtime* runtime) { if (runtime->size < (long int)sizeof(*runtime)) { return 1; // incompatible Emacs binary } emacs_env* env = runtime->get_environment(runtime); if (env->size < (long int)sizeof(*env)) { return 2; // incompatible module API } int __attribute__((unused)) emacs_version; if ((long int)sizeof(struct emacs_env_29) <= env->size) { emacs_version = 29; } else { return 3; // too old Emacs } emacs_value hw_func = env->make_function(env, 0, 0, hw, NULL, NULL); emacs_value hw_symbol = env->intern(env, "hw-func"); emacs_value args[] = {hw_symbol, hw_func}; env->funcall(env, env->intern(env, "defalias"), 2, args); return 0; } emacs_value hw(emacs_env* env, ptrdiff_t nargs __attribute__((unused)), emacs_value* args __attribute__((unused)), void* data __attribute__((unused))) { emacs_value str = env->make_string(env, "Dynamic Module Operational", 26); return str; }