Fwd: Emacs tidbits for Maxima scripts



--Boundary_(ID_b9LymRsAnhZO8b+3UfwTuw)
Content-type: text/plain
Content-transfer-encoding: 7BIT

-----Forwarded Message-----
From: BAM 
To: amundson@fnal.gov
Subject: (real one) Can't send mail to maxima list
Date: Mon, 14 Mar 2005 03:02:20 -0500

(oops, I clicked send instead of attach last time)

I've tried a few times to send this, from two different serves. I also
tried subscribing; didn't help.

Anyway, if you think this would be helpful, please forward the
attachment to the list. I read it occasionally via GMane. (See below for
my description.)

Thanks.


-------- Forwarded Message --------
From: BAM 
To: maxima@www.math.utexas.edu
Subject: Emacs tidbits for Maxima scripts
Date: Mon, 14 Mar 2005 02:51:21 -0500

Attached is something I quickly whipped up to:

1. Tell find-file-at-point where to get Maxima code
2. Tell ff-find-other-file about the file's documentation or Lisp

E.g., find-file-at-point on "load(vect)$" will open vect.mac (if point
is between the parens).


--Boundary_(ID_b9LymRsAnhZO8b+3UfwTuw)
Content-type: text/x-emacs-lisp; name=maxima-ffap.el; charset=ANSI_X3.4-1968
Content-transfer-encoding: 7BIT
Content-disposition: attachment; filename=maxima-ffap.el

;; doesn't really belong in this file
(defvar maxima-version
  (let* ((vstr (shell-command-to-string "maxima --version"))
	 (start (string-match "Maxima \\([0-9]\\)" vstr)))
    (substring vstr (match-beginning 1) (1- (length vstr))))
  "Version of currently installed Maximax as a string.")


;;; Tell find-file-at-point where to get Maxima code

(defvar ffap-maxima-path
  (cons "~/.maxima"
	(let* ((maxima (concat "/usr/share/maxima/" maxima-version))
	       (share (concat maxima "/share/")))
	  (append (mapcar		; assumes . and .. come first :(
		   (lambda (d) (concat share d))
		   (cddr (directory-files share)))
		  (list share
			(concat maxima "/src/")))))
  "Attempted guess at where Maxima's code lives.")

(defun ffap-maxima-mode (name)
  (ffap-locate-file name '(".mac" ".lisp") ffap-maxima-path))

(eval-after-load "ffap"
  '(add-to-list 'ffap-alist '(maxima-mode .  ffap-maxima-mode) t))


;;; Tell ff-find-other-file about the file's documentation or Lisp

(defvar maxima-other-file-alist
  '(("\\.mac\\'"
     (".usg" ".lisp" ".dem"))
    ("\\.usg\\'"
     (".mac")))
  "Alist for extensions related to the current file.
See `ff-other-file-alist'.")

(defun maxima-ff-other-setup ()
  ;; it's mode-local
  (setq ff-other-file-alist 'maxima-other-file-alist))

(add-hook 'maxima-mode-hook 'maxima-ff-other-setup)



--Boundary_(ID_b9LymRsAnhZO8b+3UfwTuw)--