81. Protection from the Elements
13:2 Before entering a shul or a beis medrash, one should wipe his feet and make sure his clothes are not dirty. When buildings had dirt floors, it was permissible to spit in shul so long as he then immediately rubbed the saliva into the ground with his foot. (One may not spit during the recitation of Shemoneh Esrei, as we’ll see later on in 18:9. He may also not spit in the presence of others, as that’s rude – Mishnah Brurah 151:24.)
13:3 One should not go into a shul or a beis medrash in order to get protection from the heat or the rain. If a person must enter one of these places to get someone else who is there, he should take a few moments to say a prayer or to recite some Biblical verses or learn a little Torah. At the very least, he should sit there for a short while as simply sitting there is a mitzvah. After doing one of these things, he should go find his friend.