imaxima, xemacs and windows



Osmo Salomaa <otsaloma@cc.hut.fi> writes:

> I'm using AFPL ghostscript 7.04.  I have the ghostscript location in
> my path and ghostscript is listed in the xemacs processes list. I
> don't think there should be a problem with finding the ghostscript exe.

Right, I should have known.  Starting Ghostscript is one of the first
things that happens, so you would have seen problems much earlier if it
didn't work.

> Since i get the 1.ps file in the temp folder, i would like to try
> running gs from the command line to test whether it works or
> not. Could you Jesper tell me exactly what should i type to do the
> conversion?

You can't do that directly, unfortunately.  The way it works is that gs
is started initially as an asynchronous process.  Imaxima then sends
postscript commands to the running gs process to instruct it to do the
conversions.  This is much faster than starting a new gs for every
image.

So, what you need to do is this:

* Apply the following patch:

--------------------

--- imaxima-0.5.1/imaxima.el	Sat Nov  9 06:40:28 2002
+++ imaxima.el	Mon Mar 17 02:13:18 2003
@@ -592,6 +592,24 @@
 BB is the bounding box for eps image.  WIDTH and HEIGHT are the
 dimensions of the image."
   (setq imaxima-gs-computing-p t)
+  (message (format (if imaxima-gs-7.05-is-broken
+		       "clear /imaxima-state save def \
+<< /PageSize [%d %d] /PageOffset [%d %d] /OutputFile (%s) >> \
+setpagedevice (%s) run imaxima-state restore\n"
+			  "clear \
+<< \
+/PageSize [%d %d] /PageOffset [%d %d] /OutputFile (%s) \
+>> setpagedevice [save] (%s) (r) file cvx \
+systemdict /.runandhide known revision 700 ge and {.setsafe {.runandhide}} if \
+stopped {handleerror quit} if count 1 ne {quit} if \
+cleardictstack 0 get restore\n")
+		   width
+		   height
+		   (- (aref bb 0))
+		   (aref bb 1)
+		   filename
+		   psfilename
+		   ))
   (process-send-string imaxima-gs-process
 		       (format
 			(if imaxima-gs-7.05-is-broken
--------------------


 which makes imaxima print a message about the commands sent to gs.  Do
 `C-h l' to get a better view.

* Go to the temp directory and start gs with the command line options
  you can see from doing `M-x list-processes'.

* Enter the postscript command in gs.  It will look something like this:

,----
| clear << /PageSize [217 10] /PageOffset [-125 650] /OutputFile
| (/tmp/imaxima2724u-A/1) >> setpagedevice [save]
| (/tmp/imaxima2724u-A/1.ps) (r) file cvx systemdict /.runandhide known
| revision 700 ge and {.setsafe {.runandhide}} if stopped {handleerror
| quit} if count 1 ne {quit} if cleardictstack 0 get restore
`----

-- 
Cheers,
Jesper Harder