* restarting an org-babel session? @ 2015-03-19 14:26 John Kitchin 2015-03-19 17:31 ` Ken Mankoff 0 siblings, 1 reply; 8+ messages in thread From: John Kitchin @ 2015-03-19 14:26 UTC (permalink / raw) To: Org Mode Hi all, Is it possible to restart an org-babel session from the current point? What I mean is if you have a largish org-file with many session blocks, and you want to go the end and continue it, you need to run each session block before the end to recreate the "session". I have a little function that does that more or less, but it seemed like a common enough need that it might already exist. thanks, -- Professor John Kitchin Doherty Hall A207F Department of Chemical Engineering Carnegie Mellon University Pittsburgh, PA 15213 412-268-7803 @johnkitchin http://kitchingroup.cheme.cmu.edu ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: restarting an org-babel session? 2015-03-19 14:26 restarting an org-babel session? John Kitchin @ 2015-03-19 17:31 ` Ken Mankoff 2015-03-19 17:47 ` Thomas S. Dye 0 siblings, 1 reply; 8+ messages in thread From: Ken Mankoff @ 2015-03-19 17:31 UTC (permalink / raw) To: John Kitchin; +Cc: Org Mode On 2015-03-19 at 10:26, John Kitchin <jkitchin@andrew.cmu.edu> wrote: > Is it possible to restart an org-babel session from the current point? > What I mean is if you have a largish org-file with many session blocks, > and you want to go the end and continue it, you need to run each session > block before the end to recreate the "session". I am surprised there is no easy way to have an Org file run every code block in order either on command or on export. It seems like this would be a key component of reproducible research and literate documents. Maybe there is a way, but it isn't mentioned in the "Evaluating code blocks" section of the manual. -k. ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: restarting an org-babel session? 2015-03-19 17:31 ` Ken Mankoff @ 2015-03-19 17:47 ` Thomas S. Dye 2015-03-19 18:48 ` Ken Mankoff 2015-03-19 18:58 ` John Kitchin 0 siblings, 2 replies; 8+ messages in thread From: Thomas S. Dye @ 2015-03-19 17:47 UTC (permalink / raw) To: Ken Mankoff; +Cc: Org Mode, John Kitchin Ken Mankoff <mankoff@gmail.com> writes: > On 2015-03-19 at 10:26, John Kitchin <jkitchin@andrew.cmu.edu> wrote: >> Is it possible to restart an org-babel session from the current point? >> What I mean is if you have a largish org-file with many session blocks, >> and you want to go the end and continue it, you need to run each session >> block before the end to recreate the "session". > > I am surprised there is no easy way to have an Org file run every code > block in order either on command or on export. It seems like this > would be a key component of reproducible research and literate > documents. > > Maybe there is a way, but it isn't mentioned in the "Evaluating code > blocks" section of the manual. > > -k. Would org-babel-execute-buffer work? ,-------------------------------------------------------------------- | org-babel-execute-buffer is an interactive autoloaded compiled Lisp | function in `ob-core.el'. | | (org-babel-execute-buffer &optional ARG) | | Execute source code blocks in a buffer. | Call `org-babel-execute-src-block' on every source block in | the current buffer. `-------------------------------------------------------------------- hth, Tom -- Thomas S. Dye http://www.tsdye.com ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: restarting an org-babel session? 2015-03-19 17:47 ` Thomas S. Dye @ 2015-03-19 18:48 ` Ken Mankoff 2015-03-19 18:58 ` John Kitchin 1 sibling, 0 replies; 8+ messages in thread From: Ken Mankoff @ 2015-03-19 18:48 UTC (permalink / raw) To: Thomas S. Dye; +Cc: Org Mode, John Kitchin On 2015-03-19 at 13:47, Thomas S. Dye <tsd@tsdye.com> wrote: > Ken Mankoff <mankoff@gmail.com> writes: > >> On 2015-03-19 at 10:26, John Kitchin <jkitchin@andrew.cmu.edu> wrote: >>> Is it possible to restart an org-babel session from the current point? >>> What I mean is if you have a largish org-file with many session blocks, >>> and you want to go the end and continue it, you need to run each session >>> block before the end to recreate the "session". >> >> I am surprised there is no easy way to have an Org file run every code >> block in order either on command or on export. It seems like this >> would be a key component of reproducible research and literate >> documents. >> >> Maybe there is a way, but it isn't mentioned in the "Evaluating code >> blocks" section of the manual. >> >> -k. > > Would org-babel-execute-buffer work? > Yes that works perfectly. Thanks, -k. ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: restarting an org-babel session? 2015-03-19 17:47 ` Thomas S. Dye 2015-03-19 18:48 ` Ken Mankoff @ 2015-03-19 18:58 ` John Kitchin 2015-03-19 19:13 ` Thomas S. Dye 1 sibling, 1 reply; 8+ messages in thread From: John Kitchin @ 2015-03-19 18:58 UTC (permalink / raw) To: Thomas S. Dye; +Cc: Org Mode, Ken Mankoff That is an interesting one I did not know of. I would not want to always run every block, some of them might not be part of a session, and it is possible to have multiple named sessions in a buffer. It might be good practice to not do that though ;) I will share my way of doing this if nothing else comes up. Thomas S. Dye writes: > Ken Mankoff <mankoff@gmail.com> writes: > >> On 2015-03-19 at 10:26, John Kitchin <jkitchin@andrew.cmu.edu> wrote: >>> Is it possible to restart an org-babel session from the current point? >>> What I mean is if you have a largish org-file with many session blocks, >>> and you want to go the end and continue it, you need to run each session >>> block before the end to recreate the "session". >> >> I am surprised there is no easy way to have an Org file run every code >> block in order either on command or on export. It seems like this >> would be a key component of reproducible research and literate >> documents. >> >> Maybe there is a way, but it isn't mentioned in the "Evaluating code >> blocks" section of the manual. >> >> -k. > > Would org-babel-execute-buffer work? > > ,-------------------------------------------------------------------- > | org-babel-execute-buffer is an interactive autoloaded compiled Lisp > | function in `ob-core.el'. > | > | (org-babel-execute-buffer &optional ARG) > | > | Execute source code blocks in a buffer. > | Call `org-babel-execute-src-block' on every source block in > | the current buffer. > `-------------------------------------------------------------------- > > hth, > Tom -- Professor John Kitchin Doherty Hall A207F Department of Chemical Engineering Carnegie Mellon University Pittsburgh, PA 15213 412-268-7803 @johnkitchin http://kitchingroup.cheme.cmu.edu ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: restarting an org-babel session? 2015-03-19 18:58 ` John Kitchin @ 2015-03-19 19:13 ` Thomas S. Dye 2015-03-19 20:20 ` Andreas Leha 0 siblings, 1 reply; 8+ messages in thread From: Thomas S. Dye @ 2015-03-19 19:13 UTC (permalink / raw) To: John Kitchin; +Cc: Org Mode, Ken Mankoff Aloha all, John Kitchin <jkitchin@andrew.cmu.edu> writes: > That is an interesting one I did not know of. I would not want to always > run every block, some of them might not be part of a session, and it is > possible to have multiple named sessions in a buffer. It might be good > practice to not do that though ;) If org-babel-execute-buffer is too much, there is org-babel-execute-subtree: ,--------------------------------------------------------------------- | org-babel-execute-subtree is an interactive autoloaded compiled Lisp | function in `ob-core.el'. | | It is bound to C-c C-v s, C-c C-v C-s. | | (org-babel-execute-subtree &optional ARG) | | Execute source code blocks in a subtree. | Call `org-babel-execute-src-block' on every source block in | the current subtree. `--------------------------------------------------------------------- For finer control, this might work: ,---------------------------------- | #+name: recreate-my-named-session | #+header: :session my-named-session | #+begin_src lang | <<source-code-block-1>> | <<source-code-block-2>> | #+end_src `---------------------------------- hth, Tom > > I will share my way of doing this if nothing else comes up. > > Thomas S. Dye writes: > >> Ken Mankoff <mankoff@gmail.com> writes: >> >>> On 2015-03-19 at 10:26, John Kitchin <jkitchin@andrew.cmu.edu> wrote: >>>> Is it possible to restart an org-babel session from the current point? >>>> What I mean is if you have a largish org-file with many session blocks, >>>> and you want to go the end and continue it, you need to run each session >>>> block before the end to recreate the "session". >>> >>> I am surprised there is no easy way to have an Org file run every code >>> block in order either on command or on export. It seems like this >>> would be a key component of reproducible research and literate >>> documents. >>> >>> Maybe there is a way, but it isn't mentioned in the "Evaluating code >>> blocks" section of the manual. >>> >>> -k. >> >> Would org-babel-execute-buffer work? >> >> ,-------------------------------------------------------------------- >> | org-babel-execute-buffer is an interactive autoloaded compiled Lisp >> | function in `ob-core.el'. >> | >> | (org-babel-execute-buffer &optional ARG) >> | >> | Execute source code blocks in a buffer. >> | Call `org-babel-execute-src-block' on every source block in >> | the current buffer. >> `-------------------------------------------------------------------- >> >> hth, >> Tom > > -- > Professor John Kitchin > Doherty Hall A207F > Department of Chemical Engineering > Carnegie Mellon University > Pittsburgh, PA 15213 > 412-268-7803 > @johnkitchin > http://kitchingroup.cheme.cmu.edu -- T.S. Dye & Colleagues, Archaeologists 735 Bishop St, Suite 315, Honolulu, HI 96813 Tel: 808-529-0866, Fax: 808-529-0884 http://www.tsdye.com ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: restarting an org-babel session? 2015-03-19 19:13 ` Thomas S. Dye @ 2015-03-19 20:20 ` Andreas Leha 2015-03-19 23:03 ` John Kitchin 0 siblings, 1 reply; 8+ messages in thread From: Andreas Leha @ 2015-03-19 20:20 UTC (permalink / raw) To: emacs-orgmode Hi John, tsd@tsdye.com (Thomas S. Dye) writes: > Aloha all, > > John Kitchin <jkitchin@andrew.cmu.edu> writes: > >> That is an interesting one I did not know of. I would not want to always >> run every block, some of them might not be part of a session, and it is >> possible to have multiple named sessions in a buffer. It might be good >> practice to not do that though ;) > > If org-babel-execute-buffer is too much, there is > org-babel-execute-subtree: > > ,--------------------------------------------------------------------- > | org-babel-execute-subtree is an interactive autoloaded compiled Lisp > | function in `ob-core.el'. > | > | It is bound to C-c C-v s, C-c C-v C-s. > | > | (org-babel-execute-subtree &optional ARG) > | > | Execute source code blocks in a subtree. > | Call `org-babel-execute-src-block' on every source block in > | the current subtree. > `--------------------------------------------------------------------- > > For finer control, this might work: > > ,---------------------------------- > | #+name: recreate-my-named-session > | #+header: :session my-named-session > | #+begin_src lang > | <<source-code-block-1>> > | <<source-code-block-2>> > | #+end_src > `---------------------------------- > That's what I am doing. But that is manual book-keeping. It means ultimate control but also the book-keeping to be accurate. But I agree with John, that org could be smart enough to execute the blocks of one session. > hth, > Tom > >> >> I will share my way of doing this if nothing else comes up. Please do. I would be interested in such a function, as well. Thanks, Andreas >> >> Thomas S. Dye writes: >> >>> Ken Mankoff <mankoff@gmail.com> writes: >>> >>>> On 2015-03-19 at 10:26, John Kitchin <jkitchin@andrew.cmu.edu> wrote: >>>>> Is it possible to restart an org-babel session from the current point? >>>>> What I mean is if you have a largish org-file with many session blocks, >>>>> and you want to go the end and continue it, you need to run each session >>>>> block before the end to recreate the "session". >>>> >>>> I am surprised there is no easy way to have an Org file run every code >>>> block in order either on command or on export. It seems like this >>>> would be a key component of reproducible research and literate >>>> documents. >>>> >>>> Maybe there is a way, but it isn't mentioned in the "Evaluating code >>>> blocks" section of the manual. >>>> >>>> -k. >>> >>> Would org-babel-execute-buffer work? >>> >>> ,-------------------------------------------------------------------- >>> | org-babel-execute-buffer is an interactive autoloaded compiled Lisp >>> | function in `ob-core.el'. >>> | >>> | (org-babel-execute-buffer &optional ARG) >>> | >>> | Execute source code blocks in a buffer. >>> | Call `org-babel-execute-src-block' on every source block in >>> | the current buffer. >>> `-------------------------------------------------------------------- >>> >>> hth, >>> Tom >> >> -- >> Professor John Kitchin >> Doherty Hall A207F >> Department of Chemical Engineering >> Carnegie Mellon University >> Pittsburgh, PA 15213 >> 412-268-7803 >> @johnkitchin >> http://kitchingroup.cheme.cmu.edu ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: restarting an org-babel session? 2015-03-19 20:20 ` Andreas Leha @ 2015-03-19 23:03 ` John Kitchin 0 siblings, 0 replies; 8+ messages in thread From: John Kitchin @ 2015-03-19 23:03 UTC (permalink / raw) To: Andreas Leha; +Cc: emacs-orgmode Here is my solution so far: http://kitchingroup.cheme.cmu.edu/blog/2015/03/19/Restarting-org-babel-sessions-in-org-mode-more-effectively/ It is a few functions that can go through the code blocks and selectively rerun only the blocks that are in the session of the block you run the restart command from. It is not tested too heavily, just enough for this proof of concept. j Andreas Leha writes: > Hi John, > > tsd@tsdye.com (Thomas S. Dye) writes: >> Aloha all, >> >> John Kitchin <jkitchin@andrew.cmu.edu> writes: >> >>> That is an interesting one I did not know of. I would not want to always >>> run every block, some of them might not be part of a session, and it is >>> possible to have multiple named sessions in a buffer. It might be good >>> practice to not do that though ;) >> >> If org-babel-execute-buffer is too much, there is >> org-babel-execute-subtree: >> >> ,--------------------------------------------------------------------- >> | org-babel-execute-subtree is an interactive autoloaded compiled Lisp >> | function in `ob-core.el'. >> | >> | It is bound to C-c C-v s, C-c C-v C-s. >> | >> | (org-babel-execute-subtree &optional ARG) >> | >> | Execute source code blocks in a subtree. >> | Call `org-babel-execute-src-block' on every source block in >> | the current subtree. >> `--------------------------------------------------------------------- >> >> For finer control, this might work: >> >> ,---------------------------------- >> | #+name: recreate-my-named-session >> | #+header: :session my-named-session >> | #+begin_src lang >> | <<source-code-block-1>> >> | <<source-code-block-2>> >> | #+end_src >> `---------------------------------- >> > > That's what I am doing. But that is manual book-keeping. It means > ultimate control but also the book-keeping to be accurate. But I agree > with John, that org could be smart enough to execute the blocks of one > session. > >> hth, >> Tom >> >>> >>> I will share my way of doing this if nothing else comes up. > > Please do. I would be interested in such a function, as well. > > Thanks, > Andreas > > >>> >>> Thomas S. Dye writes: >>> >>>> Ken Mankoff <mankoff@gmail.com> writes: >>>> >>>>> On 2015-03-19 at 10:26, John Kitchin <jkitchin@andrew.cmu.edu> wrote: >>>>>> Is it possible to restart an org-babel session from the current point? >>>>>> What I mean is if you have a largish org-file with many session blocks, >>>>>> and you want to go the end and continue it, you need to run each session >>>>>> block before the end to recreate the "session". >>>>> >>>>> I am surprised there is no easy way to have an Org file run every code >>>>> block in order either on command or on export. It seems like this >>>>> would be a key component of reproducible research and literate >>>>> documents. >>>>> >>>>> Maybe there is a way, but it isn't mentioned in the "Evaluating code >>>>> blocks" section of the manual. >>>>> >>>>> -k. >>>> >>>> Would org-babel-execute-buffer work? >>>> >>>> ,-------------------------------------------------------------------- >>>> | org-babel-execute-buffer is an interactive autoloaded compiled Lisp >>>> | function in `ob-core.el'. >>>> | >>>> | (org-babel-execute-buffer &optional ARG) >>>> | >>>> | Execute source code blocks in a buffer. >>>> | Call `org-babel-execute-src-block' on every source block in >>>> | the current buffer. >>>> `-------------------------------------------------------------------- >>>> >>>> hth, >>>> Tom >>> >>> -- >>> Professor John Kitchin >>> Doherty Hall A207F >>> Department of Chemical Engineering >>> Carnegie Mellon University >>> Pittsburgh, PA 15213 >>> 412-268-7803 >>> @johnkitchin >>> http://kitchingroup.cheme.cmu.edu -- Professor John Kitchin Doherty Hall A207F Department of Chemical Engineering Carnegie Mellon University Pittsburgh, PA 15213 412-268-7803 @johnkitchin http://kitchingroup.cheme.cmu.edu ^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2015-03-19 23:03 UTC | newest] Thread overview: 8+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2015-03-19 14:26 restarting an org-babel session? John Kitchin 2015-03-19 17:31 ` Ken Mankoff 2015-03-19 17:47 ` Thomas S. Dye 2015-03-19 18:48 ` Ken Mankoff 2015-03-19 18:58 ` John Kitchin 2015-03-19 19:13 ` Thomas S. Dye 2015-03-19 20:20 ` Andreas Leha 2015-03-19 23:03 ` John Kitchin
Code repositories for project(s) associated with this external index https://git.savannah.gnu.org/cgit/emacs.git https://git.savannah.gnu.org/cgit/emacs/org-mode.git This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.