https://github.com/yglukhov/emacs
Create emacs modules in nim
https://github.com/yglukhov/emacs
Last synced: 7 months ago
JSON representation
Create emacs modules in nim
- Host: GitHub
- URL: https://github.com/yglukhov/emacs
- Owner: yglukhov
- License: mit
- Created: 2020-04-07T16:33:25.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2020-04-20T12:06:22.000Z (over 5 years ago)
- Last Synced: 2024-10-14T15:04:54.357Z (12 months ago)
- Language: Nim
- Size: 14.6 KB
- Stars: 9
- Watchers: 5
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# emacs
Create emacs modules in nim. Proof of concept.# Sample
```nim
# mymod.nimimport emacs
import emacs/[utils, sugar]implementModule(Plugin_is_GPL_compatible)
discard ~provide(~mymod)
proc globalSetKey(keys: string, funcName: Value, f: proc() {.nimcall.}) =
discard ~fset(funcName, makeInteractiveFunction(f))
discard ~`global-set-key`(~kbd(keys), funcName)globalSetKey("C-c n n", ~`test-func-defined-in-nim`) do():
echo "Nim func called!" # This will go to stdout
discard ~message("This string will be displayed in status bar!")
```
```
nim c --app:lib --nomain -o:mymod.so mymod.nim
```
```lisp
;; Replace PATH_TO in the following line and add it to emacs config.
(require 'mymod (expand-file-name "PATH_TO/mymod.so"))
```
Now start emacs and press `C-c n n` to see status message from nim.