Closed johanrosenkilde closed 7 years ago
Thank you very for the pull request. Could you use sage-shell
instead of sage
the for :group
keyword in defcustom
? Also could you write document for blocks
in README.org
(just before or after ** SageTeX
section)?
By default, I've not set sage-shell-blocks.el to be included; the user has to add (request sage-shell-blocks) to his .emacs.
I think it would be better to use autoload
. And I have to change the Melpa recipe. Currently it is a recipe for a package with a single elisp file.
Also please clarify the license. (sage-shell-mode
is GPL.)
This pull request adds some simple functions to
sage-shell-mode
andsage-shell:sage-mode
to accommodate convenient workflow when structuring experimental code in "sheets" of blocks, similar to how one works with cells in a Jupyter Notebook.The use case is as follows: a user creates a "sheet" file, e.g.
experiment.sage
with blocks of code which represents both his library code as well as his experiments:In this case
load(experiment.sage)
is not a good alternative to the way one works with the Jupyter Notebook: rather, you want to evaluate the code block by block.This pull request gives a few functions:
sage-shell-blocks:forward
andsage-shell-blocks:backward
to move according to the delimiter###
(which can be changed). It also provides the functionsage-shell-blocks:send-current
which sends the region delimited by the previos###
and the following###
.If my cursor is in the body of
new_algo
, thensage-shell-blocks:send-current
would send the defs ofnew_algo
andrandom_input
to the Sage shell. Furthermore, it would print the "title" of the block:The cursor has moved to the end of the sent block, and calling
sage-shell-blocks:send-current
again will send the next block.A last function is
sage-shell-blocks:pull-next
forsage-shell-mode
to "pull" the next block from the last visitedsage-shell:sage-mode
file. This is a convenient shorthand for visiting that file yourself and sending the block.By default, I've not set
sage-shell-blocks.el
to be included; the user has to add(request sage-shell-blocks)
to his.emacs
.