All Harry could think of doing was to keep Quirrell talking and stop him from concentrating on the mirror.
(Harry Potter and the Sorcerer’s Stone)In a different phrase containing all and do, I see the infinitive complement starts without to. Is it the same when do is replaced from doing, or is the infinite marker required in the latter case?
Answer
The explicit to marking the infinitive is actually somewhat “optional”, though idiomatically it would probably be used more often than not in OP’s exact context.
But there’s no grammatical reason why All Harry could think of doing is any different to, for example,…
all I can do is watch (5690 hits in Google Books)
all I can do is to watch (3940 hits)
Not only could the to reasonably be omited in OP’s case – it could be recast as
All Harry could think to do was [to] keep Quirrell talking.
As regards …and stop him…, it’s just a stylistic choice to discard the optional to the second time. But I must admit it would be very unusual (and perhaps “ungrammatical”) to use it only for the second verb. Besides, in this exact context, that and could probably be replaced by in order to, so stopping Quirrell concentrating doesn’t quite have the same relationship to Harry’s thinking as keeping Quirrel talking.
Attribution
Source : Link , Question Author : Listenever , Answer Author : FumbleFingers