12

I'm interested in using languages other than elisp to write emacs extensions, is this possible at all? If python is not supported, what languages are?

nukeop
  • 133
  • 1
  • 5

3 Answers3

11

As Tephra said, Pymacs is a package designed for this.

It's an interface between Python and Emacs Lisp. The project isn't very active but from what I understand it's fully functional with the latest version of Emacs. A few Python packages use it (for example, Ropemacs) so any changes to Emacs that break it are likely to be fixed.

The GitHub link to the online documentation seems to be dead, but you can still find it on the Wayback Machine. The Wayback documentation is only available for version 0.23 - the current version is 0.25. The changes are pretty minor though. The Ropemacs source code is a good place to look for examples, as are the other projects implemented with Pymacs.

The problem with Pymacs is that it takes away a lot of what makes Elisp useful as a language for an extensible text editor. You have to edit source code directly if you want to change behaviour. You can't easily advise functions and you can't browse Elisp in memory. Since your Python implementation is abstracted from normal Elisp this removes a lot of the self-documenting behaviour that makes Emacs great, and errors become less informative. Extension languages like this are primarily useful for interfacing to external packages written in another language.

JCC
  • 989
  • 5
  • 15
8

You can extend Emacs in other languages, like Haskell and OCaml.

There's a discussion on Reddit about advantages and disadvantages of doing so. In short, I don't think it's a good idea to use other languages (except possibly C for performance) due to the need for an additional runtime and the lack of common knowledge by others in the Emacs community about non-Elisp extension languages.

Tianxiang Xiong
  • 3,848
  • 16
  • 27
5

There is something called Pymacs which is an python to emacs-lisp interface. Although the project doesn't seem that active. The wiki keeps a list of other modules that allows you to extend emacs in something other than elisp.

JCC
  • 989
  • 5
  • 15
Tephra
  • 821
  • 5
  • 14