1 /* Guile interface (scripting engine) */
2 /* $Id: core.c,v 1.21 2005/06/13 00:43:29 jonas Exp $ */
12 #include "config/home.h"
13 #include "main/module.h"
14 #include "scripting/guile/core.h"
15 #include "scripting/guile/hooks.h"
16 #include "util/error.h"
17 #include "util/file.h"
18 #include "util/string.h"
25 /* static SCM c_current_url(void) */
27 /* struct view_state *vs; */
29 /* if (have_location(ses) && (vs = ses ? &cur_loc(ses)->vs : 0)) */
30 /* return scm_makfrom0str(struri(vs->uri)); */
32 /* return SCM_BOOL_F; */
36 /* c_current_document */
37 /* c_current_document_formatted */
43 init_guile(struct module
*module
)
51 if (!elinks_home
) return;
53 /* Remember the current module. */
54 user_module
= scm_current_module();
56 path
= straconcat(elinks_home
, "internal-hooks.scm", NULL
);
59 if (file_can_read(path
)) {
60 /* Load ~/.elinks/internal-hooks.scm. */
61 scm_c_primitive_load_path(path
);
63 /* internal-hooks.scm should have created a new module (elinks
64 * internal). Let's remember it, even though I haven't figured
65 * out how to use it directly yet... */
66 internal_module
= scm_current_module();
68 /* Return to the user module, import bindings from (elinks
69 * internal), then load ~/.elinks/user-hooks.scm. */
70 scm_set_current_module(user_module
);
72 /* FIXME: better way? i want to use internal_module directly */
73 scm_c_use_module("elinks internal");
78 path
= straconcat(elinks_home
, "user-hooks.scm", NULL
);
80 if (file_can_read(path
))
81 scm_c_primitive_load_path(path
);