2
votes

I'm trying to find an text editor that has auto completion for the maxima language.

I heard that emacs has the best maxima support, but I could not get autocompletion to work. I did find this package:

https://github.com/auto-complete/auto-complete

And now autocompletion works for lisp, but I wonder if there is something similar for the maxima language.

enter image description here

The syntax highlighting for maxima does work btw, just no auto completion:

enter image description here

1
I typed a Google search for: auto completion maxima emacs. The fourth hit, with your question being number one, is a postscript document written by Jay Belanger that contains a section about completion .... - lawlist
I don't know how to enable autocompletion for any editor, but a useful resource might be share/builtins-list.txt which is included in the Maxima installation; maybe you can somehow tell a text editor that's the list of words to be completed. Incidentally, rmaxima is a script which launches maxima via rlwrap which handles autocompletion and some other line-editing functionality; rmaxima uses share/builtins-list.txt for the list of words. - Robert Dodier

1 Answers

1
votes

You can just turn on auto-complete with M-x auto-complete-mode. The default ac-sources has ac-source-words-in-same-mode-buffers, which will start working pretty well once you have some content in a Maxima buffer. To always enable auto-complete-mode, just add it to the mode hook (see below). It looks like there are other related modes like imaxima, so you may need to add it to several hooks.


For proper completion, you could create your own auto-complete source. Simple examples include words-in-same-mode-buffers in auto-complete.el, and the ac-math package. Once you define your source, you can add it in the hooks.

(ac-define-source maxima
  ...
  )

(defun jpk/maxima-mode-hook ()
  (add-to-list 'ac-sources 'ac-source-maxima)
  (auto-complete-mode 1))

(add-hook 'maxima-mode-hook #'jpk/maxima-mode-hook)
(add-hook 'inferior-maxima-mode-hook #'jpk/maxima-mode-hook)

As noted by @lawlist, Maxima has some built-in completion functions. You can probably build your own ac source pretty easily by reusing code from that (e.g. maxima-symbols).