sagemath / sage-shell-mode

Emacs front end for SageMath
GNU General Public License v3.0
98 stars 16 forks source link

sage-shell-mode versus sage-view #28

Closed DrWaleedAYousef closed 7 years ago

DrWaleedAYousef commented 7 years ago

Thanks for your great package;

For Sage 7.3 and lowever, I used to use sage-view which enabled me to do inline-graphics within emacs by adding these in .emacs : (add-hook 'sage-startup-after-prompt-hook 'sage-view-enable-inline-output) (add-hook 'sage-startup-after-prompt-hook 'sage-view-enable-inline-plots)

My questions: 1- Why a new package, i.e., sage-shell-mode and not elaborating on the existing one (sage-view)? 2- How can I do inline graphics in sage-shell-mode as it was in sage-view? 3- How can I do debugin for sage and python in emacs?

Thanks so much.

stakemori commented 7 years ago

1- Why a new package, i.e., sage-shell-mode and not elaborating on the existing one (sage-view)?

Because sage-view doesn't work with sage-shell-mode out of the box currently.

2- How can I do inline graphics in sage-shell-mode as it was in sage-view?

We have to make some effort to use sage-view in sage-shell-mode. This is related to #5. I will implement it in a month. Of course pull requests are very welcome.

3- How can I do debugin for sage and python in emacs?

For Python functions/methods, you can use pdb like in Sage in terminal. I think it is a little more convenient in Emacs because sage-shell-mode shows tracked files and lines.

DrWaleedAYousef commented 7 years ago

thanks so much;

one more question: can we split a .sage file to cells like those in Matlab (where each cell starts with %% and evaluates separately from the whole file)

Thanks

Sho Takemori notifications@github.com writes:

1- Why a new package, i.e., sage-shell-mode and not elaborating on the existing one (sage-view)?

Because sage-view doesn't work with sage-shell-mode out of the box currently.

2- How can I do inline graphics in sage-shell-mode as it was in sage-view?

We have to make some effort to use sage-view in sage-shell-mode. This is related to #5. I will implement it in a month. Of course pull requests are very welcome.

3- How can I do debugin for sage and python in emacs?

For Python functions/methods, you can use pdb like in Sage in terminal. I think it is a little more convenient in Emacs because sage-shell-mode shows tracked files and lines.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.*

stakemori commented 7 years ago

I don't know cells in Matlab very well, but code-blocks written by Johan Rosenkilde or ob-sagemath might be useful.

stakemori commented 7 years ago

I have just ported sage-view. You can enable sage-shell-view minor mode as follows.

(add-hook 'sage-shell-after-prompt-hook #'sage-shell-view)

And I close this issue because it is a duplicate of #5.

DrWaleedAYousef commented 7 years ago

Wonderful, I tried it!!

BTW, "show" launches jmol to play interactively with the figure. Can I show inside emacs.

Sho Takemori notifications@github.com writes:

Closed #28.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.*

stakemori commented 7 years ago

BTW, "show" launches jmol to play interactively with the figure. Can I show inside emacs.

The method show for 3d graph objects launches jmol. They can be embedded inside Emacs by a_3d_graph_obj.show(viewer='tachyon').

For example, the following code shows a 2D graph inside Emacs.

sage: implicit_plot3d(x^2+y^2+z^2==4, (x, -3, 3), (y, -3,3), (z, -3,3)).show(viewer='tachyon')

Alternatively, you can change the viewer globally.

sage: sage.plot.plot3d.base.SHOW_DEFAULTS['viewer']  = 'tachyon'

See http://doc.sagemath.org/html/en/reference/plot3d/sage/plot/plot3d/base.html for detail.

DrWaleedAYousef commented 7 years ago

thanks so much,

but using tachyon inside emacs will not provide interactive graphics like jmol; right? Is there any way to make graphics interactive inside emacs so that I have all-inside emacs.

Thanks again for your time

Sho Takemori notifications@github.com writes:

BTW, "show" launches jmol to play interactively with the figure. Can I
show inside emacs.

The method show for 3d graph objects launches jmol. They can be embedded inside Emacs by a_3d_graph_obj.show(viewer='tachyon').

For example, the following code shows a 2D graph inside Emacs.

sage: implicit_plot3d(x^2+y^2+z^2==4, (x, -3, 3), (y, -3,3), (z, -3,3)).show(viewer='tachyon')

Alternatively, you can change the viewer globally.

sage: sage.plot.plot3d.base.SHOW_DEFAULTS['viewer'] = 'tachyon'

See http://doc.sagemath.org/html/en/reference/plot3d/sage/plot/plot3d/base.html for detail.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.*

stakemori commented 7 years ago

I opened a Sage notebook with xwidget-webkit-browse-url. See the image below. I can rotate the sphere by mouse. Perhaps, by the xwidgets feature, it might be possible to embed the jmol viewer inside Emacs. But I'm not sure at the moment.

sage_notebook_in_emacs

stakemori commented 7 years ago

I opened a new issue (#29).