1 ;; Copyright (C) 2007, 2008, 2017 Yasuaki Honda
2 ;; Copyright (C) 2017 Roland Salz
4 ;; Author: Yasuaki Honda (yasuaki.honda@gmail.com)
5 ;; $Id: setup-imaxima-imath.el,v 1.6 2009-02-22 09:18:27 yasu-honda Exp $
7 ;; Adapted by Roland Salz 2016-2017
8 ;; to be used alternatively with builds from installer, repository-snapshot or tarball.
10 ;; - define and bind global variable *maxima-build-type* to "repo-tarball" or "installer" and
11 ;; - define and bind global variable *maxima-build-dir* to the root directory of the build,
12 ;; as a string terminated by a slash.
13 ;; If these two variables are not defined and bound in .emacs,
14 ;; as default the first installer found in "C:/" is used.
16 ;; This program is free software; you can redistribute it and/or
17 ;; modify it under the terms of the GNU General Public License as
18 ;; published by the Free Software Foundation; either version 2 of
19 ;; the License, or (at your option) any later version.
21 ;; This program is distributed in the hope that it will be
22 ;; useful, but WITHOUT ANY WARRANTY; without even the implied
23 ;; warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
24 ;; PURPOSE. See the GNU General Public License for more details.
26 ;; You should have received a copy of the GNU General Public
27 ;; License along with this program; if not, write to the Free
28 ;; Software Foundation, Inc., 59 Temple Place, Suite 330, Boston,
32 ;;; Set up Emacs for Imaxima with MiKTeX, and Ghostscript
36 ; MikTeX has to be installed before.
37 ; Packages breqn, l3kernel, mathtools, unicode-data (and mhequ?) have to be installed with the MikTeX package manager before.
39 (defvar *imaxima-miktex-bin-dir
*
40 (cond ((file-expand-wildcards "c:/Program Files*/MiKTeX*/miktex/bin/latex.exe")
41 (file-name-directory (car (file-expand-wildcards "c:/Program Files*/MiKTeX*/miktex/bin/latex.exe"))))
42 ((file-expand-wildcards "c:/Program Files*/MiKTeX*/miktex/bin/x64/latex.exe")
43 (file-name-directory (car (file-expand-wildcards "c:/Program Files*/MiKTeX*/miktex/bin/x64/latex.exe"))))
44 (t (display-warning :error
"setup-imaxima-imath.el: MikteX not found in C:/Programa Files/")))
45 "MiKTeX bin directory, added to exec-path")
47 ; latex.exe is specified for the latex program to be invoked.
48 (setq imaxima-tex-program
"latex.exe")
52 ; Ghostscript has to be installed before.
54 (defvar *imaxima-gs-bin-dir
*
55 (if (file-expand-wildcards "c:/Program Files*/gs/gs*/bin/gswin*.exe")
56 (file-name-directory (car (file-expand-wildcards "c:/Program Files*/gs/gs*/bin/gswin*.exe")))
57 (display-warning :error
"setup-imaxima-imath.el: Ghostscript not found in C:/Programa Files/"))
58 "Ghostscript bin directory, added to exec-path")
60 ; ghostscript executable is specified for the gs program to be invoked.
61 (setq imaxima-gs-program
62 (file-name-nondirectory (car (file-expand-wildcards "c:/Program Files*/gs/gs*/bin/gswin??c.exe"))))
65 ; Set up path to maxima.bat:
67 (defvar *imaxima-maxima-bin-dir
*
68 (if (and (boundp '*maxima-build-type
*) (boundp '*maxima-build-dir
*))
69 (cond ((equal *maxima-build-type
* "repo-tarball")
70 (concat *maxima-build-dir
* "src/"))
71 ((equal *maxima-build-type
* "installer")
72 (concat *maxima-build-dir
* "bin/"))
73 (t (display-warning :error
"setup-imaxima-imath.el: *maxima-build-type* invalid")))
74 (if (file-expand-wildcards "c:/Maxima*/bin/maxima.bat")
75 (file-name-directory (car (file-expand-wildcards "c:/Maxima*/bin/maxima.bat")))
76 (display-warning :error
"setup-imaxima-imath.el: no Maxima installer found in C:/")))
77 "Maxima bin directory, added to exec-path")
79 (if (not (file-exists-p (concat *imaxima-maxima-bin-dir
* "maxima.bat")))
80 (display-warning :error
"setup-imaxima-imath.el: maxima.bat not found"))
82 ; set up maxima-command to maxima.bat, which resides in the above path.
83 (setq maxima-command
"maxima.bat")
85 ; maxima.bat is specified as the maxima program for imaxima.
86 (setq imaxima-maxima-program
"maxima.bat")
89 ; Set up .el, imaxima and info directories:
91 (defvar *imaxima-maxima-el-dir
*
92 (if (and (boundp '*maxima-build-type
*) (boundp '*maxima-build-dir
*))
93 (if (equal *maxima-build-type
* "repo-tarball")
94 (concat *maxima-build-dir
* "interfaces/emacs/emaxima/")
95 (file-name-directory (car (file-expand-wildcards (concat *maxima-build-dir
* "share/maxima/*/emacs/maxima.el")))))
96 (file-name-directory (car (file-expand-wildcards "c:/Maxima*/share/maxima/*/emacs/maxima.el"))))
97 "Maxima emacs mode maxima.el directory, added to load-path")
100 (defvar *imaxima-imath-dir
*
101 (if (and (boundp '*maxima-build-type
*) (boundp '*maxima-build-dir
*))
102 (if (equal *maxima-build-type
* "repo-tarball")
103 (concat *maxima-build-dir
* "interfaces/emacs/imaxima/")
104 *imaxima-maxima-el-dir
*)
105 *imaxima-maxima-el-dir
*)
106 "Imaxima imath directory, containing .el, .lisp and .info files")
108 ;;; The following definition eases the locating of imaxima.lisp.
109 (setq imaxima-lisp-file
(concat *imaxima-imath-dir
* "imaxima.lisp"))
112 (defvar *imaxima-maxima-info-dir
*
113 (if (and (boundp '*maxima-build-type
*) (boundp '*maxima-build-dir
*))
114 (if (equal *maxima-build-type
* "repo-tarball")
115 (concat *maxima-build-dir
* "doc/info/")
116 (concat *maxima-build-dir
* "share/info/"))
117 (file-name-directory (car (file-expand-wildcards "c:/Maxima*/share/info/maxima.info"))))
118 "Maxima info directory, added to Info-additional-directory-list")
122 (setq exec-path
(append (list *imaxima-gs-bin-dir
* *imaxima-maxima-bin-dir
* *imaxima-miktex-bin-dir
*) exec-path
))
125 (setq load-path
(append (list *imaxima-imath-dir
* *imaxima-maxima-el-dir
*) load-path
))
127 ;;; set up Info-additional-directory-list
128 (if (not (boundp 'Info-additional-directory-list
))
129 (setq Info-additional-directory-list nil
))
131 (setq Info-additional-directory-list
(append (list *imaxima-imath-dir
* *imaxima-maxima-info-dir
*) Info-additional-directory-list
))
133 ;;; imaxima-maxima-options should be "" instead of "(user::run)"
134 ;;; assigned in the imaxima.el
135 (setq imaxima-maxima-options
"")
137 (autoload 'maxima
"maxima" "Maxima CAS mode" t nil
)
139 (autoload 'imaxima
"imaxima" "Graphical frontend for Maxima CAS" t nil
)
141 (autoload 'imath-mode
"imath" "Math text mode" t nil
)