Get the unevaluated expression from a numbered cell

If a cell exists as below:

In[1] := (xyPoints = {{1,2},{2,5},{3,10}}; ListLinePlot[xyPoints])


Is it possible to get at the expression rather than the plot shown in Out[1]. In other words, can I somehow get the held CompoundExpression in In[1] rather than the evaluated plot?

-
DownValues[In][[2]] –  Rolf Mertig Aug 13 '13 at 22:07
Awesome. Looks like I can use something like: DownValues[In][[1]] /. RuleDelayed[x_, y_] :> HoldComplete[y] –  teedr Aug 13 '13 at 22:17
Interestingly, this does not work if there is a newline after the semicolon. –  teedr Aug 13 '13 at 22:38
You could also use Information[In] or ToExpression[InString[1], StandardForm, Hold] –  Alexey Popkov Aug 14 '13 at 2:12

You could use InString for that:

ToExpression[InString[1], StandardForm, Hold]


Hold[xyPoints = {{1, 2}, {2, 5}, {3, 10}}; ListLinePlot[xyPoints]]

-
Great. Do you know if there a way to get all the lines in a cell? If a compound expression is spread over multiple lines, each line seems to correspond to a different In[x] number. –  teedr Aug 14 '13 at 17:51
@teedr You could try to experiment with DownValues[InString] for that. –  Alexey Popkov Aug 14 '13 at 21:41
Cells[CellLabel -> "In[1]:="] // First // NotebookRead //
First // MakeExpression


gives

HoldComplete[xyPoints = {{1, 2}, {2, 5}, {3, 10}};
ListLinePlot[xyPoints]]

-