Skip to content

Commit 697d47f

Browse files
committed
Explain #[module] option mod_in_name a little bit better, fixing #17
1 parent 6df43d7 commit 697d47f

File tree

2 files changed

+8
-7
lines changed

2 files changed

+8
-7
lines changed

emacs-macros/src/lib.rs

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,15 +18,17 @@ mod func;
1818
///
1919
/// - `name`: By default, the name of the feature provided by the module is the crate's name (with
2020
/// `_` replaced by `-`). There is no need to explicitly call `provide` inside the initializer. This
21-
/// option allows the initializer's name, or a string, to be used instead. For examples:
22-
/// `#[module(name(fn))]`, or `#[module(name = "feature-name")]`.
21+
/// option allows the initializer's name, or a string, to be used instead. Examples:
22+
/// `#[module(name(fn))]`, `#[module(name = "feature-name")]`.
2323
///
2424
/// - `defun_prefix` and `separator`: Function names in Emacs are conventionally prefixed with the
2525
/// feature name followed by `-`. These 2 options allow different prefix and separator to be used.
26-
/// For example: `#[module(name = "foo-dyn", defun_prefix = "foo", separator = "/")]`.
26+
/// Example: `#[module(name = "foo-dyn", defun_prefix = "foo", separator = "/")]`.
2727
///
28-
/// - `mod_in_name`: Whether to put module path in function names. Default to `true`. This can also
29-
/// be overridden for each individual function, by an option of the same name on [`#[defun]`].
28+
/// - `mod_in_name`: Whether to use Rust's `mod` path to construct function names. Default to
29+
/// `true`. For example, supposed that the crate is named `parser`, a `#[defun]` named `next_child`
30+
/// inside `mod cursor` will have the Lisp name of `parser-cursor-next-child`. This can also be
31+
/// overridden for each individual function, by an option of the same name on [`#[defun]`].
3032
///
3133
/// [`#[defun]`]: attr.defun.html
3234
#[proc_macro_attribute]

guide/src/module.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,6 @@ fn init(env: &Env) -> Result<()> {
4343
fn init(_: &Env) -> Result<()> { Ok(()) }
4444
```
4545

46-
- `mod_in_name`: Whether to put module path in [function names](./functions.md#naming). Default to `true`. This can also be overridden for each individual function, by an option of the same name on `#[defun]`.
47-
46+
- `mod_in_name`: Whether to use Rust's `mod` path to construct [function names](./functions.md#naming). Default to `true`. For example, supposed that the crate is named `parser`, a `#[defun]` named `next_child` inside `mod cursor` will have the Lisp name of `parser-cursor-next-child`. This can also be overridden for each individual function, by an option of the same name on `#[defun]`.
4847

4948
**Note**: Often time, there's no initialization logic needed. A future version of this crate will support putting `#![emacs::module]` on the crate, without having to define a no-op function. See Rust's [issue #54726](https://github.com/rust-lang/rust/issues/54726).

0 commit comments

Comments
 (0)