The most productive thing to do is make sure you have an environment that allows you to remember and operate mentally on the detailed results of your thinking, without having to set everything down. This is so you don't get into the habit of writing as soon as anything comes to mind and editing it, and rewriting it, over and over.
A more productive habit is writing satisfactory text if you are writing, and moving on. This is possible only if you can edit in your mind and the environment aids you in this, instead of disrupting this process. You later rewrite or cut or add to this whole only a few parts. Editing thoughts is much easier. Easier than what? Than editing copy. It's much faster, too.
Donald Broadbent's Decision and Stress, 1971, London, Academic, has quantitative discussion with graphs of the effects on productivity and problem solving and memory --- of most environmental factors. Varying irritations in quantity has often nonlinear results. A significantly large number of things reduce work productivity --- and they interact. This book reviews most of the literature. Research level text, still cited. Much of it is about what harms representative memory.
Most memory is reconstruction (anticipated by George Mead, 1932) not storage, you abstract and chunk (Miller, Pribram, Galanter, 1960). Stored bits are rapidly processed into reconstructive memory and the stored bits discarded: Morten Christiansen and Nick Chater, April 2015, The Now-or-Never Bottleneck, Behavioral and Brain Sciences 39(1):e62.
You must remove all the irritants from your environment, yes, if you want it go like that. A work room, according to Bohr (says Wheeler), is a room where nobody can stop you from working; that is however the bare minimum.
Your brain neuronal at a cognitive level is a model reconstructing a similar sensation with similar and often different inputs all of several types. So there is no bits storage capacity limitation problem like in a hard drive --- but there are reconstructive limitations (Karl Pribram, 1966, Some Dimensions of Remembering, Macromolecules and Behavior, New York, Appleton Century Crofts). They correlate with where you are.
So you also need anything present that regenerates the thoughts you usually think. Only then can you edit them mentally into mental text. Presence of irritants such as temperature prevent remembering, but so does absence of other things. If you can't remember long texts, you'll be more frequently writing down text as as it comes. Then you will edit it, and rewrite it many times. Which is a much slower process of working than ... It violates Robert Heinlein's rules for writers about not rewriting too much. Rewriting too much gives you less output. For more publishable output you want a quiet peaceful environment, not too warm, but also one that is rich in objects to aid memory or cause you to recall related ideas. Functions with no input reconstruct no output and you don't remember much.