Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.soft-sys.math.mathematica > #12603 > unrolled thread
| Started by | Fred Simons <f.h.simons@tue.nl> |
|---|---|
| First post | 2012-12-04 09:09 +0000 |
| Last post | 2012-12-07 06:36 +0000 |
| Articles | 6 — 5 participants |
Back to article view | Back to comp.soft-sys.math.mathematica
Mathematica 9: bug in merging cells Fred Simons <f.h.simons@tue.nl> - 2012-12-04 09:09 +0000
Re: Mathematica 9: bug in merging cells David Reiss <dbreiss@gmail.com> - 2012-12-05 08:10 +0000
Re: Mathematica 9: bug in merging cells Rafapa <rafapa@simulux.us.es> - 2012-12-05 08:11 +0000
Re: Mathematica 9: bug in merging cells "Rolf.Mertig@gmail.com" <Rolf.Mertig@gmail.com> - 2012-12-06 09:57 +0000
Re: Mathematica 9: bug in merging cells David Reiss <dbreiss@gmail.com> - 2012-12-06 09:55 +0000
Re: Mathematica 9: bug in merging cells "Rolf.Mertig@gmail.com" <rolf.mertig@gmail.com> - 2012-12-07 06:36 +0000
| From | Fred Simons <f.h.simons@tue.nl> |
|---|---|
| Date | 2012-12-04 09:09 +0000 |
| Subject | Mathematica 9: bug in merging cells |
| Message-ID | <k9kekh$68c$1@smc.vnet.net> |
When writing a larger program, I usually test the single steps in
separate cells, then merge these cells and localize the variables by
wrapping the contents of the merged cells in a Module. By doing so in
Mathematica 9, due to a bug in merging cells, I lost a lot of code. I
reported this bug to WRI two weeks ago. It is not yet repaired in the
new release, so I thought I would mention this annoying bug here as well.
This is an example (Mathematica 9 for Windows, I am not aware if this
happens for other systems too).
Construct two input cells, the first one containing
a=1;
(* comment *)
b=2;
and the second one
c=3;
When merging these two cells the contents ending with the comment is
shown in an orange rectangle, with the error message that there is a
RowBox with an invalid first argument. I cannot see any reason why this
merging of cells could not be undone with ctrl-Z, but it cannot and
therefore part of my code was gone.
In this simple example I could see how to fix it. Toggle ctrl-E for
seeing the box structure. Place a } just behind the RowBox with the
comment and a { behind the very first RowBox[, that is followed on the
next line with another RowBox.
During writing this message, I found that the same happens when you try
to copy and paste the first cell.
Fred Simons
Eindhoven University of Technology
[toc] | [next] | [standalone]
| From | David Reiss <dbreiss@gmail.com> |
|---|---|
| Date | 2012-12-05 08:10 +0000 |
| Message-ID | <k9mvi8$b9k$1@smc.vnet.net> |
| In reply to | #12603 |
Just a quick observation to note that one does not need the comment
between the first two code lines, the presence of a carriage return is
all that's needed to create the error upon merging the two cells.
Thus, the first cell would contain
a = 1;
b = 2;
and the second cell would have any code in it: e.g.,
c = 3;
Then merge the two and the error box appears.
--David
On Dec 4, 4:09 am, Fred Simons <f.h.sim...@tue.nl> wrote:
> When writing a larger program, I usually test the single steps in
> separate cells, then merge these cells and localize the variables by
> wrapping the contents of the merged cells in a Module. By doing so in
> Mathematica 9, due to a bug in merging cells, I lost a lot of code. I
> reported this bug to WRI two weeks ago. It is not yet repaired in the
> new release, so I thought I would mention this annoying bug here as well.
>
> This is an example (Mathematica 9 for Windows, I am not aware if this
> happens for other systems too).
>
> Construct two input cells, the first one containing
>
> a=1;
> (* comment *)
> b=2;
>
> and the second one
>
> c=3;
>
> When merging these two cells the contents ending with the comment is
> shown in an orange rectangle, with the error message that there is a
> RowBox with an invalid first argument. I cannot see any reason why this
> merging of cells could not be undone with ctrl-Z, but it cannot and
> therefore part of my code was gone.
>
> In this simple example I could see how to fix it. Toggle ctrl-E for
> seeing the box structure. Place a } just behind the RowBox with the
> comment and a { behind the very first RowBox[, that is followed on the
> next line with another RowBox.
>
> During writing this message, I found that the same happens when you try
> to copy and paste the first cell.
>
> Fred Simons
> Eindhoven University of Technology
[toc] | [prev] | [next] | [standalone]
| From | Rafapa <rafapa@simulux.us.es> |
|---|---|
| Date | 2012-12-05 08:11 +0000 |
| Message-ID | <k9mvk5$bas$1@smc.vnet.net> |
| In reply to | #12603 |
On Tuesday, December 4, 2012 10:09:37 AM UTC+1, Fred Simons wrote:
> When writing a larger program, I usually test the single steps in
>
> separate cells, then merge these cells and localize the variables by
>
> wrapping the contents of the merged cells in a Module. By doing so in
>
> Mathematica 9, due to a bug in merging cells, I lost a lot of code. I
>
> reported this bug to WRI two weeks ago. It is not yet repaired in the
>
> new release, so I thought I would mention this annoying bug here as well.
>
>
>
> This is an example (Mathematica 9 for Windows, I am not aware if this
>
> happens for other systems too).
>
>
>
> Construct two input cells, the first one containing
>
>
>
> a=1;
>
> (* comment *)
>
> b=2;
>
>
>
> and the second one
>
>
>
> c=3;
>
>
>
> When merging these two cells the contents ending with the comment is
>
> shown in an orange rectangle, with the error message that there is a
>
> RowBox with an invalid first argument. I cannot see any reason why this
>
> merging of cells could not be undone with ctrl-Z, but it cannot and
>
> therefore part of my code was gone.
>
>
>
> In this simple example I could see how to fix it. Toggle ctrl-E for
>
> seeing the box structure. Place a } just behind the RowBox with the
>
> comment and a { behind the very first RowBox[, that is followed on the
>
> next line with another RowBox.
>
>
>
> During writing this message, I found that the same happens when you try
>
> to copy and paste the first cell.
>
>
>
> Fred Simons
>
> Eindhoven University of Technology
Same problem with Mathematica 9.0.0 under Linux x86 (64 bit).
Rafael R. Pappalardo
Univ. of Seville (Spain)
[toc] | [prev] | [next] | [standalone]
| From | "Rolf.Mertig@gmail.com" <Rolf.Mertig@gmail.com> |
|---|---|
| Date | 2012-12-06 09:57 +0000 |
| Message-ID | <k9pq5u$hor$1@smc.vnet.net> |
| In reply to | #12634 |
What I really like about Mathematica is that it can often fix its own bugs:
Evaluate the following in your notebook
Button["Fix9", (NotebookWrite[#1,
NotebookRead[#1] //.
HoldPattern[RowBox[a_, b__]] :> RowBox[{a, b}]] & ) /@
Cells[CellStyle -> "Input"]]
Clicking on it will magically restore wrongly merged cells.
But I hope that with 9.0.1 this will be fixed.
Rolf Mertig
GluonVision GmbH
(web)Mathematica consulting
Berlin, Germany
[toc] | [prev] | [next] | [standalone]
| From | David Reiss <dbreiss@gmail.com> |
|---|---|
| Date | 2012-12-06 09:55 +0000 |
| Message-ID | <k9pq3e$hn7$1@smc.vnet.net> |
| In reply to | #12634 |
I reported the bug.
On Dec 5, 3:11 am, Rafapa <raf...@simulux.us.es> wrote:
> On Tuesday, December 4, 2012 10:09:37 AM UTC+1, Fred Simons wrote:
> > When writing a larger program, I usually test the single steps in
>
> > separate cells, then merge these cells and localize the variables by
>
> > wrapping the contents of the merged cells in a Module. By doing so in
>
> > Mathematica 9, due to a bug in merging cells, I lost a lot of code. I
>
> > reported this bug to WRI two weeks ago. It is not yet repaired in the
>
> > new release, so I thought I would mention this annoying bug here as well.
>
> > This is an example (Mathematica 9 for Windows, I am not aware if this
>
> > happens for other systems too).
>
> > Construct two input cells, the first one containing
>
> > a=1;
>
> > (* comment *)
>
> > b=2;
>
> > and the second one
>
> > c=3;
>
> > When merging these two cells the contents ending with the comment is
>
> > shown in an orange rectangle, with the error message that there is a
>
> > RowBox with an invalid first argument. I cannot see any reason why this
>
> > merging of cells could not be undone with ctrl-Z, but it cannot and
>
> > therefore part of my code was gone.
>
> > In this simple example I could see how to fix it. Toggle ctrl-E for
>
> > seeing the box structure. Place a } just behind the RowBox with the
>
> > comment and a { behind the very first RowBox[, that is followed on the
>
> > next line with another RowBox.
>
> > During writing this message, I found that the same happens when you try
>
> > to copy and paste the first cell.
>
> > Fred Simons
>
> > Eindhoven University of Technology
>
> Same problem with Mathematica 9.0.0 under Linux x86 (64 bit).
>
> Rafael R. Pappalardo
> Univ. of Seville (Spain)
[toc] | [prev] | [next] | [standalone]
| From | "Rolf.Mertig@gmail.com" <rolf.mertig@gmail.com> |
|---|---|
| Date | 2012-12-07 06:36 +0000 |
| Message-ID | <k9s2qa$mo8$1@smc.vnet.net> |
| In reply to | #12658 |
Running this and restarting Mathematica will provide a keyboard
shortcut Command Option m (Mac) or Command (or WindowsKey) Optiom m
(Windows)
or Mod1 Alt m on Linux as an alternative to the buggy Control Shift
m
I also added a key for deleting all outputs and one for quitting the
kernel since I find this useful.
Rolf
P.s.: This can also be invoked most conveniently as
Import["http://www.mertig.com/mykeys.m"]
(* ******************************************************* *)
(* ::Package:: *)
(* ::Section:: *)
(*Keyevents for M9*)
(* ::Text:: *)
(*Author: Rolf Mertig, http://www.mertig.com, GluonVision GmbH,
Berlin, Germany*)
(* ::Text:: *)
(*Executing the code below generates a KeyEventTranslations.tr in a
subdirectory in $UserBaseDirectory *)
$OverWriteUserBaseDirectoryKeyEventTranslations = True;
mymenuitems="
(* Delete all Output, Message and Print cells in the selected
notebook
Basically my answer from http://mathematica.stackexchange.com/a/13992/29
Windows: Command (Windows-Key) Alt d deletes all Output and
Message and Print Cells
MacOSX: Command Option d
*)
Item[KeyEvent[\"d\", Modifiers -> {Option, Command}],
KernelExecute[
Module[{nb = SelectedNotebook[]},
Scan[Function[c, If[NotebookFind[nb, c, All,
CellStyle, AutoScroll -> False] =!= $Failed,
NotebookDelete[nb, AutoScroll ->
False]]
],
{\"Message\", \"Output\", \"Print\"}
];
SelectionMove[nb,After,Notebook];
]
], MenuEvaluator -> Automatic ],\n
(* Merge cells fix for M9; instead of
Control Shift M
Windows: Command Alt m
MacOSX: Command Option m
can be used instead: *)
Item[KeyEvent[\"m\", Modifiers -> {Command,Option}],
KernelExecute[
FrontEndExecute[FrontEndToken[\"CellMerge\"]];
Module[{ce=Cells[CellStyle -> \"Input\"]},
Scan[Function[x,NotebookWrite[x,ReplaceRepeated[NotebookRead[x],
RuleDelayed[HoldPattern[RowBox[Pattern[a,Blank[]],Pattern[b,BlankSequence[]]]],RowBox[List[a,b]]]]]],ce];
];
] , MenuEvaluator -> Automatic ],
(* Quit the kernel by Command Alt k
from http://mathematica.stackexchange.com/questions/6224/best-way-to-add-keyevents-and-faster-quit?rq=1
*)
Item[KeyEvent[\"k\", Modifiers -> {Command,Option}],
KernelExecute[ToExpression[\"Quit[]\"]
], MenuEvaluator -> Automatic
],
";
With[{os =
Switch[$OperatingSystem,"MacOSX","Macintosh","Windows","Windows","Unix","X"]},
Quiet@CreateDirectory@FileNameJoin[{$UserBaseDirectory,"SystemFiles","FrontEnd","TextResources",os}];
mykeyeventtrans=FileNameJoin[{$UserBaseDirectory,"SystemFiles","FrontEnd","TextResources",os,"KeyEventTranslations.tr"}];
If[$OverWriteUserBaseDirectoryKeyEventTranslations===True,
If[FileExistsQ[mykeyeventtrans],DeleteFile@mykeyeventtrans];
CopyFile[FileNameJoin[{$InstallationDirectory,"SystemFiles","FrontEnd","TextResources",
os,"KeyEventTranslations.tr"}],mykeyeventtrans]
]];
keytext=Import[mykeyeventtrans,"Text"];
mykeytext=StringReplace[keytext,"EventTranslations[{":>StringJoin["EventTranslations[{\n",mymenuitems,"\n"]];
Export[mykeyeventtrans,mykeytext,"Text"];
Print["Please quit the FrontEnd and restart.
Then, for Windows ( Command = Windows Key )
Command Alt d deletes all Output
and Message and Print Cells
Command Alt m merges Cells, like
Control Shift m, but fixes a M9 bug
Command Alt k quits the kernel
for MacOSX :
Command Option d deletes all Output
and Message and Print Cells
Command Option m merges Cells, like
Control Shift m, but fixes a M9 bug
Command Option k quits the kernel
Fox X11 :
Mod1 Alt d deletes all Output
and Message and Print Cells
Mod1 Alt m merges Cells, like
Control Shift m, but fixes a M9 bug
Mod1 Alt k quits the kernel
"];
Quit[];
[toc] | [prev] | [standalone]
Back to top | Article view | comp.soft-sys.math.mathematica
csiph-web