;;; reduce-ide-install.el -- install REDUCE IDE semi-automatically ;; Author: Francis J. Wright ;; Time-stamp: <14 February 2000> ;; This installer assumes GNU Emacs 20.4+ and REQUIRES 20.3+. ;; It assumes the following or later REDUCE IDE file versions: ;; reduce-mode.el 1.0 required ;; reduce-run.el 1.0 optional ;; reduce-ide.info*, dir.info optional ;; Other files in the distribution provide optional additional ;; documentation in other formats, and are not part of the Emacs ;; installation. ;; Choose or create a directory for the REDUCE IDE files, copy THIS ;; FILE and all the REDUCE IDE files that you wish to install into the ;; chosen directory, make it the current directory and then execute or ;; load this file. For example, if you have a buffer visiting this ;; file then from the Emacs-Lisp menu select the option `Evaluate ;; Buffer'; if you are visiting the directory in `dired' mode then put ;; the cursor on this file (`reduce-ide-install.el') and press `L'. ;; There is no point compiling this file! ;; Require GNU Emacs 20.3+: ;; (The next sexp, at least, should run in ALL versions of Emacs!) (eval-and-compile (if (condition-case nil (and (string-match "GNU Emacs 20" (emacs-version)) (>= emacs-minor-version 3)) (error nil)) () (error "This version of REDUCE IDE requires GNU Emacs 20.3+") )) ;; Byte-compiling interrupts the loading of this file, so the ;; following must be a single top-level form (which also makes ;; debugging easier!): (progn ;; REDUCE Edit Mode -- required (unless (file-readable-p "reduce-mode.el") (error "The file \"reduce-mode.el\" is required!")) (unless (file-newer-than-file-p "reduce-mode.elc" "reduce-mode.el") (byte-compile-file "reduce-mode.el")) (or user-init-file (error "You must start Emacs with its normal initialization file")) (or (file-writable-p user-init-file) (error "Your initialization file \"%s\" is not writable" user-init-file)) (let* ((dir default-directory) (standard-output (find-file user-init-file)) (start (point-max)) (default-directory dir) (case-fold-search (memq system-type '(vax-vms windows-nt)))) (goto-char start) (setq dir (directory-file-name dir)) (princ " ;;; REDUCE IDE configuration:\n\n") (unless (locate-library "reduce-mode") (princ "(add-to-list 'load-path ") (prin1 dir) (princ ")\n")) (or (assoc-default "xxx.red" auto-mode-alist 'string-match) (princ "\ \(add-to-list 'auto-mode-alist '(\"\\\\.red\\\\'\" . reduce-mode))\n")) (or (assoc-default "xxx.tst" auto-mode-alist 'string-match) (princ "\ \(add-to-list 'auto-mode-alist '(\"\\\\.tst\\\\'\" . reduce-mode))\n")) (or (fboundp 'reduce-mode) (princ "\ \(autoload 'reduce-mode \"reduce-mode\" \ \"Major mode for REDUCE code editing\" t)\n\n")) ;; REDUCE IDE customization auto-load (or (memq 'custom-group (symbol-plist 'reduce)) ; flagp (princ "\ \(defgroup reduce nil \"Support for editing and running REDUCE code.\" :tag \"REDUCE\" :group 'languages :load \"reduce-mode\")\n\n")) ;; REDUCE Run Mode -- optional (when (file-readable-p "reduce-run.el") (unless (file-newer-than-file-p "reduce-run.elc" "reduce-run.el") (byte-compile-file "reduce-run.el")) (or (fboundp 'run-reduce) (princ "\ \(autoload 'run-reduce \"reduce-run\" \ \"Run an inferior REDUCE process\" t)\n")) (unless (and (boundp 'reduce-mode-load-hook) (memq 'require-reduce-run reduce-mode-load-hook)) (or (y-or-n-p "Auto-load REDUCE Run Mode? ") (princ ";;;")) (princ "\ \(add-hook 'reduce-mode-load-hook 'require-reduce-run)\n"))) ;; REDUCE IDE info documentation -- optional (when (and (file-readable-p "reduce-ide.info") (not (or (assoc-default default-directory Info-default-directory-list 'string-match t) (and (boundp 'Info-additional-directory-list) (assoc-default default-directory Info-additional-directory-list 'string-match t))))) ; (princ " ; \(add-to-list 'Info-default-directory-list ") ; (prin1 default-directory) (princ ")\n") (princ " \(setq Info-default-directory-list (append Info-default-directory-list '(") (prin1 default-directory) (princ ")))\n") ) (save-buffer) (message "\ *** WAIT: Please check the end of your initialization file \"%s\" ***" user-init-file) (sit-for 5) (when (y-or-n-p "Activate the REDUCE IDE configuration now? ") (eval-region start (point-max)) (if (y-or-n-p "Customize the REDUCE IDE now? ") (customize-group 'reduce))) ) ) ;;; reduce-ide-install.el ends here