Use the built-in `maxima' library with `ob-maxima'

This commit is contained in:
Gerard Vermeulen 2023-12-05 20:05:01 +01:00
parent 14b66c9b67
commit 47bf549414
1 changed files with 32 additions and 15 deletions

View File

@ -2174,7 +2174,7 @@ list detailing and motivating each listing:
(lilypond . ,(fboundp 'lilypond-mode))
(lisp . t)
(lua . ,(fboundp 'lua-mode))
(maxima . ,(fboundp 'maxima-mode))
(maxima . t)
(org . t)
(perl . t)
;; Beware: Python activation must not call still unbound functions.
@ -2920,8 +2920,8 @@ Return a list of items where the filename is the `car' of each item and the
#+RESULTS: lst:org-babel-active-languages
#+begin_src emacs-lisp -n :eval never :tangle no
(("calc") ("conf") ("emacs-lisp") ("eshell") ("fortran") ("js")
("latex") ("latex-extra-header") ("latex-header") ("lisp") ("org")
("perl") ("python") ("shell") ("text") ("toml"))
("latex") ("latex-extra-header") ("latex-header") ("lisp") ("maxima")
("org") ("perl") ("python") ("ruby") ("shell") ("text") ("toml"))
#+end_src
*** [[https://github.com/bdarcus/citar][Citar: citing bibliography]] with [[https://orgmode.org/][Org Mode]]
@ -5329,27 +5329,28 @@ byte code:
(add-to-list 'auto-mode-alist `(,(rx ".go" eos) . go-ts-mode)))
#+end_src
** [[info:maxima#Top][Maxima Programming (info)]] :noexport:
** [[info:maxima#Top][Maxima Programming (info)]]
:PROPERTIES:
:CUSTOM_ID: sec:maxima-programming
:header-args:emacs-lisp: :tangle no
:END:
Listing [[lst:configure-maxima]] configures [[https://gitlab.com/sasanidas/maxima][Maxima Mode]]. The following list contains
more information:
1. [[https://gitlab.com/sasanidas/maxima][Maxima Mode]] is an Emacs interface to the computer algebra system [[https://en.wikipedia.org/wiki/Maxima_(software)][Maxima]].
Listing [[lst:configure-maxima]] configures the built-in =maxima= library. The
following list contains more information:
1. [[https://gitlab.com/sasanidas/maxima][Maxima Mode]] is an archived Emacs interface to the computer algebra system [[https://en.wikipedia.org/wiki/Maxima_(software)][Maxima]].
2. [[https://orgmode.org/worg/org-contrib/babel/languages/ob-doc-maxima.html][Maxima Source Code Blocks in Org Mode]] shows how to use [[https://en.wikipedia.org/wiki/Maxima_(software)][Maxima]] in [[https://orgmode.org/][Org Mode]].
3. [[https://home.csulb.edu/~woollett/mbe.html][Maxima By Example]] is a tutorial for [[https://en.wikipedia.org/wiki/Maxima_(software)][Maxima]].
Listing [[lst:maxima-example]] is a minimal example of how to use how to use [[https://en.wikipedia.org/wiki/Maxima_(software)][Maxima]]
in [[https://orgmode.org/][Org Mode]].
Listing [[lst:maxima-example]] is a minimal example of how to use [[info:maxima#Top][Maxima (info)]] in
[[https://orgmode.org/][Org Mode]] and it can work without the built-in =maxima= library or [[https://gitlab.com/sasanidas/maxima][Maxima Mode]].
Enabling =maxima-mode= serves only to fontify the code.
#+caption[Configure =maxima=]:
#+caption: Configure =maxima=.
#+name: lst:configure-maxima
#+begin_src emacs-lisp -n :results silent
(when (ensure-package-installation 'maxima 'company-maxima)
(add-hook 'maxima-mode-hook #'maxima-hook-function)
(add-hook 'maxima-inferior-mode-hook #'maxima-hook-function)
(when (require 'maxima nil t)
;; In case of https://gitlab.com/sasanidas/maxima, uncomment the next 2 lines:
;; (add-hook 'maxima-mode-hook #'maxima-hook-function)
;; (add-hook 'maxima-inferior-mode-hook #'maxima-hook-function)
(add-to-list 'auto-mode-alist
(cons "\\.mac\\'" 'maxima-mode))
(add-to-list 'interpreter-mode-alist
@ -5358,9 +5359,25 @@ in [[https://orgmode.org/][Org Mode]].
#+caption[Maxima example]:
#+caption: Maxima example.
#+caption: The code is fontified because =maxima-mode= is enabled.
#+header: :wrap "src text -n"
#+name: lst:maxima-example
#+begin_src maxima -n :exports code :results silent
print(1+1);
#+begin_src maxima -n :batch batch :cmdline --quiet :exports both :results raw
rat(1/(x+1) + x/(x-1));
#+end_src
#+caption[Maxima example results]:
#+caption: Maxima example results.
#+name: lst:maxima-example-results
#+results: lst:maxima-example
#+begin_src text -n
(%i1) (linenum:0,
(%i1) rat(1/(x+1)+x/(x-1))
2
x + 2 x - 1
(%o1)/R/ ------------
2
x - 1
#+end_src
** [[https://www.seas.upenn.edu/~chaoliu/2017/09/01/python-programming-in-emacs/][Python programming]]