Closed hpdeifel closed 5 years ago
That option is a bit confusing. It is about Rust's submodule mod
, not Emacs's dynamic module.
For example, in the case of vec_size
, it is to prevent the name from being t/test-vector-vec-size
.
It's documented here. If you have read it and still misunderstood, I'll have to improve the doc.
Ah, I see. I have in fact not looked at this particular section of the guide, my bad.
The reason for my confusion is probably the documentation for emacs_macros::module
, which reads
mod_in_name: Whether to put module path in function names. Default to true. This can also be overridden for each individual function, by an option of the same name on [#[defun]].
There could be an indication that it is actually about the Rust "module path" instead of the Emacs module, especially since the macro itself is called module
. The documentation for emacs_macros::defun
is clearer, but I just skimmed over it because I thought I already understood mod_in_name
from the docstring of module
.
The example in your link really helps, maybe it would be a good idea to put a shorter version of that in the API reference.
Side question: So the way to have the Elisp function name derived only from the Rust function name is to set defun_prefix
and separator
to ""
and mod_in_name
to false
. This feels like going against the grain (which may be intended), but maybe a shorthand could be useful?
Good point! I'll update the doc.
Side question: So the way to have the Elisp function name derived only from the Rust function name is to set defun_prefix and separator to "" and mod_in_name to false. This feels like going against the grain (which may be intended), but maybe a shorthand could be useful?
For defun_prefix
and separator
, yes they are intended, since Lisp functions should usually be prefixed with their package name. For mod_in_name
, I'm starting to think false
is a better default. I think they are not too bad though, as they are specified only once per crate. I want to wait for #9 before revamping crate-wide options.
This was fixed in the latest release.
mod_in_name
doesn't seem to have any effect, neither as parameter to#[module]
nor[defun]
, unless I'm misunderstanding its purpose.E.g. a rust function
is defined in elisp as
module-name-foo
instead of justfoo
.Notice that this is also true for the test cases of this project. See e.g.
vec_size
intest-module/src/test_vector.rs
, which is called from elisp ast/vec-size