Emacs Swift module provides a convenient API for writing dynamic modules for Emacs in Swift. It marries a dynamic nature of Emacs Lisp with strong static typization of Swift and hides the roughness of the original C API together with harder aspects of that language such as a lack of closures and manual memory management. It also translates Emacs Lisp errors and Swift exceptions into each other.
A Quick Tour
EmacsSwiftModule allows you to call functions from Emacs Lisp using Swift’s own types.
let two: Int = try env.funcall("+", with: 1, 1)
assert(two == 2)
try env.funcall("message", with: "%S %S", "Hello", 42)
And define your own Lisp functions out of Swift closures
try env.defun("foo") {
(x: Int, y: Int) in x + y
}
try env.defun("bar") {
(input: [String]) in input.joined(separator: ", ")
}
EmacsSwiftModule
A Swift library to write Emacs plugins in Swift!
Overview
Emacs Swift module provides a convenient API for writing dynamic modules for Emacs in Swift. It marries a dynamic nature of Emacs Lisp with strong static typization of Swift and hides the roughness of the original C API together with harder aspects of that language such as a lack of closures and manual memory management. It also translates Emacs Lisp errors and Swift exceptions into each other.
A Quick Tour
EmacsSwiftModule
allows you to call functions from Emacs Lisp using Swift’s own types.And define your own Lisp functions out of Swift closures
that can be easily used in Emacs Lisp
It handles errors on both sides so the user can almost always simply ignore them.
And on the Lisp side too
The same happens when a type requirement expected in Swift is not met.
Documentation
Full documentation of the package can be found here: https://savchenkovaleriy.github.io/emacs-swift-module/documentation/emacsswiftmodule/
Installation
Swift Package Manager
Add the following line to you package dependencies:
Or add
"https://github.com/SavchenkoValeriy/emacs-swift-module.git"
directly via Xcode.Contribute
All contributions are most welcome!
It might include any help: bug reports, questions on how to use it, feature suggestions, and documentation updates.
License
GPL-3.0