go-emacs-module

command module
v0.0.0-...-4c76517 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 18, 2019 License: GPL-2.0 Imports: 3 Imported by: 0

README

go-emacs-module

This doesn't work, but it's a start at getting a module written in Go that Emacs can use.

Building

Requires emacs-module.h, which is created when Emacs configure is run.

Some package managers that don't keep source might remove it. macOS Homebrew removes it -- some patches (example) restore it, or brew cask emacs puts it in /Applications/Emacs.app/Contents/Resources/include/emacs-module.h.

% go build -o emacsmodtest.so -buildmode=c-shared && emacs --batch -nw -Q -L $(pwd) --eval "(require 'emacsmodtest)" --eval "(princ (frob))"
emacs version: 26
hello from frob!
borf%

What works

  • intern a symbol, get the symbol value
  • call a Go func from Emacs (just one, with no arguments)

Todo

  • Convert args for the thunk to a Go slice
  • Make the thunk call a different Go func
  • Figure out if all this casting is safe

Notes

Emacs requires the symbol plugin_is_GPL_compatible. It doesn't need it to be anything in particular, and cgo is happy exporting functions, so I made it a function.

fmt.Printf is nice for testing from the command line, but would be bad at runtime.

Documentation

The Go Gopher

There is no documentation for this package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL