in the document of HoldAllComplete, it says: Evaluate
cannot be used to override HoldAllComplete.
.
for example, when I'm trying L.Shifrin's package,
CodeFormatterMakeBoxes has the HoldAllComplete
Attribute, how can I use it for CellExpression
?
For example, I want to make CodeFormatterMakeBoxes[f@CellPrint@( cells[1]=Cell[BoxData[ RowBox[{"Plot", "[", RowBox[{"x", ",", RowBox[{"{", RowBox[{"x", ",", "0", ",", "10"}], "}"}]}], "]"}]], "Input"]])
generate the output like CodeFormatter[MakeBoxes[Plot[x,{x,0,10}]]]=RowBox[{"Plot", "[", RowBox[{"x", ",", RowBox[{"{", RowBox[{"x", ",", "0", ",", "10"}], "}"}]}], "]"}]
?
CodeFormatterMakeBoxes // Definition
(*
Attributes[CodeFormatterMakeBoxes]={HoldAllComplete} CodeFormatterMakeBoxes[CodeFormatter`
Private`args__]:=CodeFormatter`Private`makeBoxes[CodeFormatter`Private`args]
*)
A complex usage version :
First[FrontEndExecute[FrontEnd`ExportPacket[Cell[BoxData@FullCodeFormat@CodeFormatterMakeBoxes[#]&@ToExpression[First[FrontEndExecute[FrontEnd`ExportPacket[cellExpression,"InputText"]]],StandardForm,Hold],"Input"],"InputText"]]]
bad thing is x^2
becomes Power[x,2]
, and actually I want to put FullCodeFormat
here:
First[FrontEndExecute[FrontEnd`ExportPacket[FullCodeFormat@cellExpression,"InputText"]]
Comments
Post a Comment