Drexel dragonThe Math ForumDonate to the Math Forum



Search All of the Math Forum:

Views expressed in these public forums are not endorsed by Drexel University or The Math Forum.


Math Forum » Discussions » Software » comp.soft-sys.math.mathematica

Topic: Mathematica 9: bug in merging cells
Replies: 5   Last Post: Dec 7, 2012 1:36 AM

Advanced Search

Back to Topic List Back to Topic List Jump to Tree View Jump to Tree View   Messages: [ Previous | Next ]
Rolf.Mertig@gmail.com

Posts: 38
Registered: 11/23/05
Re: Mathematica 9: bug in merging cells
Posted: Dec 7, 2012 1:36 AM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

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[];




Point your RSS reader here for a feed of the latest messages in this topic.

[Privacy Policy] [Terms of Use]

© Drexel University 1994-2014. All Rights Reserved.
The Math Forum is a research and educational enterprise of the Drexel University School of Education.