Warning: this is an htmlized version!
The original is here, and
the conversion rules are here.
;; This file:
;;   http://anggtwu.net/MAXIMA/when-maxima.lisp.html
;;   http://anggtwu.net/MAXIMA/when-maxima.lisp
;;          (find-angg "MAXIMA/when-maxima.lisp")
;; Author: Eduardo Ochs <eduardoochs@gmail.com>
;; Many thanks to: bike from #clschool
;; License: Public Domain
;; Date: 2024oct29
;;
;; See: (find-maximamsg "58834908 202410 29" "Edrx: #+maxima (progn (in-package :maxima) ...)")
;;      (find-maximamsg "58834959 202410 29" "Edrx: I found an ugly solution")
;;      (find-maximamsg "58835811 202410 30" "Stavros: with shared substructures")
;;      (find-maximamsg "58835817 202410 30" "Stavros: Lisp 1.5 Programmer's Manual")
;;      (find-maximamsg "58835825 202410 30" "RToy: OK by me to push :maxima onto CL:*FEATURES*")
;;      (find-maximamsg "58835735 202410 31" "RToy: #.(cl:if (cl:find-package '#:f2cl) '(and) '(or))")

(defpackage :otherpackage (:use :common-lisp))
(in-package :otherpackage)

(defun foo (o) (+ 2 o))


;; Maxima functions:
;;
(eval-when (:compile-toplevel :load-toplevel :execute) ;/ #if (find-package :maxima)
  (when (find-package :maxima)                         ;|
    (in-package :maxima)))                             ;| (in-package :maxima)
(eval-when (:compile-toplevel :load-toplevel :execute) ;|
  (when (find-package :maxima)                         ;|

    (defun $foo (o) (otherpackage::foo o))

    ))                                                 ;\ #endif


#|
* (eepitch-sbcl)
* (eepitch-kill)
* (eepitch-sbcl)
(load "when-maxima.lisp")
(in-package :otherpackage)
(foo 30)
(apropos "foo")  ;;<- note that $foo is not fbound!

* (eepitch-maxima)
* (eepitch-kill)
* (eepitch-maxima)
load("when-maxima.lisp");
foo(30);

|#