MathGroup Archive 2007

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Close Evaluation Cell in Version 6.0

  • To: mathgroup at smc.vnet.net
  • Subject: [mg76298] Re: [mg76213] Close Evaluation Cell in Version 6.0
  • From: "Lev Bishop" <lev.bishop+mathgroup at gmail.com>
  • Date: Sat, 19 May 2007 04:38:54 -0400 (EDT)
  • References: <200705181001.GAA12547@smc.vnet.net>

On 5/18/07, Januk wrote:
> In the new version, I really like the ability to close a group of
> cells while displaying whichever cell you like from that group (just
> double-click the bracket for that cell).  For me, this means that I
> can hide the code which creates some nice output.  Unfortunately, if
> you re-evaluate that cell-group, the group opens up showing the code.
>
> I wasn't able to find it, but is there a function or short set of
> commands that I could use to automatically collapse a group of cells
> while displaying say the last cell in the group?  The closest I could
> find is:

You can make a style for your cells which supplies the following options:
CellProlog :> Module[{nb = EvaluationNotebook[]},
 SelectionMove[nb, All, EvaluationCell];
 SelectionMove[nb, All, CellGroup];
 SaveGrouping`save =
  Replace[NotebookRead[nb], {Cell[CellGroupData[___, cg_], ___] :> cg,
     Blank[] -> None}]]

CellEpilog:> Module[{nb = EvaluationNotebook[]},
  If[SaveGouping`save =!= None,
   SelectionMove[nb, All, EvaluationCell];
   SelectionMove[nb, All, CellGroup];
   NotebookWrite[nb, Replace[NotebookRead[nb],
     Cell[CellGroupData[a___, _], b___] :>
      Cell[CellGroupData[a, SaveGrouping`save], b]]]]]

This will make it so that mathematica remembers the current grouping
of a cell when you start evaluating it, and restores that grouping
after the evaluation is complete.

Lev


  • Prev by Date: Re: Close Evaluation Cell in Version 6.0
  • Next by Date: Re: A harmless and amusing bug
  • Previous by thread: Re: Close Evaluation Cell in Version 6.0
  • Next by thread: Re: Close Evaluation Cell in Version 6.0