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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
31 ;;; Set up Emacs for Imaxima with MiKTeX, and Ghostscript
35 ; MikTeX has to be installed before.
36 ; Packages breqn, l3kernel, mathtools, unicode-data (and mhequ?) have to be installed with the MikTeX package manager before.
38 (defvar *imaxima-miktex-bin-dir
*
39 (cond ((file-expand-wildcards "c:/Program Files*/MiKTeX*/miktex/bin/latex.exe")
40 (file-name-directory (car (file-expand-wildcards "c:/Program Files*/MiKTeX*/miktex/bin/latex.exe"))))
41 ((file-expand-wildcards "c:/Program Files*/MiKTeX*/miktex/bin/x64/latex.exe")
42 (file-name-directory (car (file-expand-wildcards "c:/Program Files*/MiKTeX*/miktex/bin/x64/latex.exe"))))
43 (t (display-warning :error
"setup-imaxima-imath.el: MikteX not found in C:/Programa Files/")))
44 "MiKTeX bin directory, added to exec-path")
46 ; latex.exe is specified for the latex program to be invoked.
47 (setq imaxima-tex-program
"latex.exe")
51 ; Ghostscript has to be installed before.
53 (defvar *imaxima-gs-bin-dir
*
54 (if (file-expand-wildcards "c:/Program Files*/gs/gs*/bin/gswin*.exe")
55 (file-name-directory (car (file-expand-wildcards "c:/Program Files*/gs/gs*/bin/gswin*.exe")))
56 (display-warning :error
"setup-imaxima-imath.el: Ghostscript not found in C:/Programa Files/"))
57 "Ghostscript bin directory, added to exec-path")
59 ; ghostscript executable is specified for the gs program to be invoked.
60 (setq imaxima-gs-program
61 (file-name-nondirectory (car (file-expand-wildcards "c:/Program Files*/gs/gs*/bin/gswin??c.exe"))))
64 ; Set up path to maxima.bat:
66 (defvar *imaxima-maxima-bin-dir
*
67 (if (and (boundp '*maxima-build-type
*) (boundp '*maxima-build-dir
*))
68 (cond ((equal *maxima-build-type
* "repo-tarball")
69 (concat *maxima-build-dir
* "src/"))
70 ((equal *maxima-build-type
* "installer")
71 (concat *maxima-build-dir
* "bin/"))
72 (t (display-warning :error
"setup-imaxima-imath.el: *maxima-build-type* invalid")))
73 (if (file-expand-wildcards "c:/Maxima*/bin/maxima.bat")
74 (file-name-directory (car (file-expand-wildcards "c:/Maxima*/bin/maxima.bat")))
75 (display-warning :error
"setup-imaxima-imath.el: no Maxima installer found in C:/")))
76 "Maxima bin directory, added to exec-path")
78 (if (not (file-exists-p (concat *imaxima-maxima-bin-dir
* "maxima.bat")))
79 (display-warning :error
"setup-imaxima-imath.el: maxima.bat not found"))
81 ; set up maxima-command to maxima.bat, which resides in the above path.
82 (setq maxima-command
"maxima.bat")
84 ; maxima.bat is specified as the maxima program for imaxima.
85 (setq imaxima-maxima-program
"maxima.bat")
88 ; Set up .el, imaxima and info directories:
90 (defvar *imaxima-maxima-el-dir
*
91 (if (and (boundp '*maxima-build-type
*) (boundp '*maxima-build-dir
*))
92 (if (equal *maxima-build-type
* "repo-tarball")
93 (concat *maxima-build-dir
* "interfaces/emacs/emaxima/")
94 (file-name-directory (car (file-expand-wildcards (concat *maxima-build-dir
* "share/maxima/*/emacs/maxima.el")))))
95 (file-name-directory (car (file-expand-wildcards "c:/Maxima*/share/maxima/*/emacs/maxima.el"))))
96 "Maxima emacs mode maxima.el directory, added to load-path")
99 (defvar *imaxima-imath-dir
*
100 (if (and (boundp '*maxima-build-type
*) (boundp '*maxima-build-dir
*))
101 (if (equal *maxima-build-type
* "repo-tarball")
102 (concat *maxima-build-dir
* "interfaces/emacs/imaxima/")
103 *imaxima-maxima-el-dir
*)
104 *imaxima-maxima-el-dir
*)
105 "Imaxima imath directory, containing .el, .lisp and .info files")
107 ;;; The following definition eases the locating of imaxima.lisp.
108 (setq imaxima-lisp-file
(concat *imaxima-imath-dir
* "imaxima.lisp"))
111 (defvar *imaxima-maxima-info-dir
*
112 (if (and (boundp '*maxima-build-type
*) (boundp '*maxima-build-dir
*))
113 (if (equal *maxima-build-type
* "repo-tarball")
114 (concat *maxima-build-dir
* "doc/info/")
115 (concat *maxima-build-dir
* "share/info/"))
116 (file-name-directory (car (file-expand-wildcards "c:/Maxima*/share/info/maxima.info"))))
117 "Maxima info directory, added to Info-additional-directory-list")
121 (setq exec-path
(append (list *imaxima-gs-bin-dir
* *imaxima-maxima-bin-dir
* *imaxima-miktex-bin-dir
*) exec-path
))
124 (setq load-path
(append (list *imaxima-imath-dir
* *imaxima-maxima-el-dir
*) load-path
))
126 ;;; set up Info-additional-directory-list
127 (if (not (boundp 'Info-additional-directory-list
))
128 (setq Info-additional-directory-list nil
))
130 (setq Info-additional-directory-list
(append (list *imaxima-imath-dir
* *imaxima-maxima-info-dir
*) Info-additional-directory-list
))
132 ;;; imaxima-maxima-options should be "" instead of "(user::run)"
133 ;;; assigned in the imaxima.el
134 (setq imaxima-maxima-options
"")
136 (autoload 'maxima
"maxima" "Maxima CAS mode" t nil
)
138 (autoload 'imaxima
"imaxima" "Graphical frontend for Maxima CAS" t nil
)
140 (autoload 'imath-mode
"imath" "Math text mode" t nil
)