here's another trick i use, by the way. It simply attaches the current
buffer to sage, so you just need to go C-x C-s on your file in order
to send everything :

(defun sage-attach-current-buffer ()
"attach current .sage file"
(interactive)
(process-send-string (get-buffer "*SAGE-main*")
                     (concat
                      "attach \""
                      (buffer-file-name (current-buffer))
                      "\"\n")))

I don't know how well this would work with a .py file that's imported
as a module in the current sage session... is it possible to attach
modules ? i don't think so.

here's a last one:

(defun sage-add-to-path ()
  "adds the path to the current buffer to the sage path"
  (interactive)
  (process-send-string (get-buffer "*SAGE-main*")
                       (concat
                        "import sys\n"
                        "import os\n"
                        "sys.path.append("
                        " os.path.split('"
                        (buffer-file-name (current-buffer))
                        "' )[0] )\n"
                        "print 'added to SAGE path:', sys.path[-1]\n")))


may be useful for "import" commands to work, sometimes.

pierre
--~--~---------~--~----~------------~-------~--~----~
To post to this group, send email to sage-devel@googlegroups.com
To unsubscribe from this group, send email to 
sage-devel-unsubscr...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/sage-devel
URLs: http://www.sagemath.org
-~----------~----~----~----~------~----~------~--~---

Reply via email to