Re: syntax-aware selection in palette notebook

*To*: mathgroup at smc.vnet.net*Subject*: [mg112189] Re: syntax-aware selection in palette notebook*From*: "Ingolf Dahl" <ingolf.dahl at telia.com>*Date*: Sat, 4 Sep 2010 03:59:40 -0400 (EDT)

If with "syntax-aware" means that you do Ctrl+. , you might achieve the same by Button["SelectionMoveAllExpression", SelectionMove[EvaluationNotebook[], All, Expression]] But sometimes something is fishy with SelectionMove. Let us create four additional buttons: Button["SelectionMoveBeforeExpression", SelectionMove[EvaluationNotebook[], Before, Expression]] Button["SelectionMoveAfterExpression", SelectionMove[EvaluationNotebook[], After, Expression]] Button["SelectionMovePreviousExpression", SelectionMove[EvaluationNotebook[], Previous, Expression]] Button["SelectionMoveNextExpression", SelectionMove[EvaluationNotebook[], Next, Expression]] I have tested them on the expression Sin[x] + Cos[y] The first button, "SelectionMoveAllExpression", works as expected. To me it seems a bit counterintuitive that a single bracket "[" is an expression, but for Mathematica "everything is an expression", so OK with that. The button "SelectionMoveBeforeExpression" also seem okey, unless the cursor is placed after the letter "i" in Sin. Then the cursor is just moved to the position after S. Is "i" in "Sin" an expression? The button "SelectionMoveAfterExpression" does not do anything at all, while the button "SelectionMoveNextExpression" does the job that "SelectionMoveAfterExpression" should have done, with a similar behavior inside words as "SelectionMoveBeforeExpression". And the button "SelectionMovePreviousExpression" does exactly the same job as "SelectionMoveBeforeExpression". In the tutorial " Manipulating Notebooks from the Kernel" the word "Expression" is said to mean "complete subexpression". Can someone be pedagogic and help me in my ignorance? Best regards Ingolf Dahl > -----Original Message----- > From: Murray Eisenberg [mailto:murray at math.umass.edu] > Sent: den 22 augusti 2010 14:10 > To: mathgroup at smc.vnet.net > Subject: [mg111963] syntax-aware selection in palette notebook > > If I have a palette notebook already created, how can I open it in a way > that I (1) see the underlying expressions; and (2) can select in a > syntax-aware manner, just like you can with input expressions in an > ordinary notebook? > > Is there some way in Mathematica itself? > > In Workbench? If so, how do you open the palette notebook there that way? > > -- > Murray Eisenberg murray at math.umass.edu > Mathematics & Statistics Dept. > Lederle Graduate Research Tower phone 413 549-1020 (H) > University of Massachusetts 413 545-2859 (W) > 710 North Pleasant Street fax 413 545-1801 > Amherst, MA 01003-9305