From: Yasuaki H. <yas...@us...> - 2009-02-08 07:44:45
|
Update of /cvsroot/maxima/maxima/interfaces/emacs/imaxima In directory 23jxhf1.ch3.sourceforge.com:/tmp/cvs-serv19799 Modified Files: imath.el imaxima.el Log Message: There is a fix to make imath work properly with the new imaxima.el. Index: imath.el =================================================================== RCS file: /cvsroot/maxima/maxima/interfaces/emacs/imaxima/imath.el,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- imath.el 3 Nov 2008 06:16:23 -0000 1.3 +++ imath.el 8 Feb 2009 07:44:32 -0000 1.4 @@ -289,6 +289,8 @@ (yank) (insert ";") (comint-send-input)))) + (if continuation + (debug-imaxima-filter "continuation exits")) (setq continuation (list (if (string-match "[ ]*wx\\(plot2d\\|plot3d\\|draw\\|draw2d\\|draw3d\\|implicit_plot\\|contour_plot\\).*" maxcmd) #'get-inline-graph #'get-image-from-imaxima-1) @@ -317,8 +319,10 @@ (yank) (insert ";") (comint-send-input)) - (setq continuation (list (if (string-match "[ ]*wx\\(plot2d\\|plot3d\\|draw\\|draw2d\\|draw3d\\|implicit_plot\\|contour_plot\\).*" maxcmd) - #'(lambda (arg) + (if continuation + (debug-imaxima-filter "continuation exits")) + (setq continuation (list (if (string-match "[ ]*wx\\(plot2d\\|plot3d\\|draw\\|draw2d\\|draw3d\\|implicit_plot\\|contour_plot\\).*" maxcmd) + #'(lambda (arg) (let ((cont continuation)) (funcall #'get-inline-graph arg) (save-current-buffer @@ -392,7 +396,7 @@ (if (featurep 'xemacs) (let ((ext (extent-at 0 latex-string))) (if ext (set-extent-property ext 'duplicable nil)))) - (when (string-match "^([\\%a-zA-Z0-9]+)" latex-string) + (while (string-match "^([\\%a-zA-Z0-9]+)" latex-string) (setq latex-string (replace-match "" t t latex-string))) (if continuation (let ((maxima-string (save-current-buffer Index: imaxima.el =================================================================== RCS file: /cvsroot/maxima/maxima/interfaces/emacs/imaxima/imaxima.el,v retrieving revision 1.5 retrieving revision 1.6 diff -u -d -r1.5 -r1.6 --- imaxima.el 4 Feb 2009 16:53:26 -0000 1.5 +++ imaxima.el 8 Feb 2009 07:44:32 -0000 1.6 @@ -945,10 +945,12 @@ (if imaxima-filter-running (progn (setq imaxima-output (concat imaxima-output str)) + (debug-imaxima-filter "reenter") (return-from imaxima-filter ""))) (setq imaxima-filter-running t) (debug-imaxima-filter str) - (let* ((len (length str))) + (let* ((len (length str)) + main-output) (if (zerop len) "" (setq imaxima-output (concat imaxima-output str)) @@ -960,22 +962,32 @@ (message "Processing Maxima output...") (while (not (string= imaxima-output "")) (let ((1stchar (substring imaxima-output 0 1))) - (debug-imaxima-filter (concat "1stchar is " 1stchar " imaxima-output is " imaxima-output)) (cond ((string= 1stchar "") (if (string-match "\\([^]*\\)\\(\\(.\\|\n\\)*\\)" imaxima-output) (let ((iprompt (match-string 1 imaxima-output)) (rest (match-string 2 imaxima-output))) (setq imaxima-output rest) - (setq output (concat output iprompt))) + (setq output (concat output iprompt)) + ;; All the output for a maxima command are processed. + ;; We can call continuation if necessary. + (cond ((and continuation main-output) + (funcall (car continuation) main-output)) + ((and continuation (null main-output)) + (funcall (car continuation) "")))) ;; imaxima-output is incomplete. (setq imaxima-filter-running nil) (return-from imaxima-filter output))) ((string= 1stchar "") (if (string-match "\\([^]*\\)\\(\\(.\\|\n\\)*\\)" imaxima-output) (let ((match (match-string 1 imaxima-output)) - (rest (match-string 2 imaxima-output))) + (rest (match-string 2 imaxima-output)) + image) (setq imaxima-output rest) - (setq output (concat output (imaxima-make-image match 'latex)))) + (setq output (concat output (setq image (imaxima-make-image match 'latex)))) + ;; Remember the image into main-output if this is the first output. + ;; This will be passed to continuation + (if (null main-output) + (setq main-output image))) ;; imaxima-output is incomplete. (setq imaxima-filter-running nil) (return-from imaxima-filter output))) @@ -996,8 +1008,6 @@ ;; This should not happen. (message "Unexpected error encountered in imaxima-filter")))))) (message "Processing Maxima output...done") - (if continuation - (funcall (car continuation) output)) (setq imaxima-filter-running nil) (return-from imaxima-filter output))))) |