וַיִּיקַ֣ץ יַעֲקֹב֮ מִשְּׁנָתוֹ֒ וַיֹּ֕אמֶר אָכֵן֙ יֵ֣שׁ יְהֹוָ֔ה בַּמָּק֖וֹם הַזֶּ֑ה וְאָנֹכִ֖י לֹ֥א יָדָֽעְתִּי׃
Jacob awoke from his sleep and said, “Surely יהוה is present in this place, and I did not know it!”
וַיִּירָא֙ וַיֹּאמַ֔ר מַה־נּוֹרָ֖א הַמָּק֣וֹם הַזֶּ֑ה אֵ֣ין זֶ֗ה כִּ֚י אִם־בֵּ֣ית אֱלֹהִ֔ים וְזֶ֖ה שַׁ֥עַר הַשָּׁמָֽיִם׃
Shaken, he said, “How awesome is this place! This is none other than the abode of God, and that is the gateway to heaven.”
אין ישנים בב"ה אפילו שינת עראי אבל בבית המדרש מותר:
We don't sleep in a synagogue, even for impromptu sleep, but in a house of study, it is permitted.
ואין ישנים בבית הכנסת אפילו שינת עראי. אבל בית המדרש מותר למי שלומד שם. ולצורך בית הכנסת מותר לאכול ולישן בתוכן, רק לא להכניס מיטה לשם (מגן אברהם סעיף קטן ד'). ומטעם זה ישנים בליל יום הכיפורים בבית הכנסת כדי לשמור הנרות, שלא יארע סיבה. וגם הישנים שם אומרים הרבה תהלים ושירות ותשבחות. וכן לצורך מצוה מותר, כמו בזמן הקדמון שהיו נכנסים לעיבור השנה לבית הכנסת, ולא היו הולכים לבתיהם כלל – יכולים לאכול ולישן שם. אך הם היו עולים רק בפת וקטניות. וכן כשעושים סיום על מסכתא, וכל שכן על יותר – יכולים לאכול מעט בבית המדרש, דזהו סעודת מצוה. ולקבוע שם סעודה גדולה נראה שאינו כדאי, ואין לעשות כן רק בדוחק גדול. וזהו דווקא בסעודת מצוה של תלמוד תורה, ולא של מצוה אחרת כסעודת ברית מילה או פדיון הבן או חתונה – אסור, דאין לזה שייכות לבית המדרש.
One should not sleep in a synagogue, even a nap. But it is permissible to do so in a beit midrash for one who learns there. And for the sake of the synagogue itself one can eat or sleep there but one should not bring a mattress into the synagogue. And for this reason one can sleep in the synagogue on the night of Yom Kippur in order to guard the candles so that no bad thing occur. Also those who sleep in the synagogue on Yom Kippur to guard the candles recite many Psalms and songs and praises. It is also permissible to sleep in the synagogue for a mitzvah purpose like in earlier times they would enter the synagogue to intercalculate the year and they would not return to their homes at all and would eat and sleep there. But they ate only simple foods (bread and beans). And when one makes a siyum on a massechet, and certainly if one makes a siyum on something larger, one can eat in the beit midrash since that is a se'udat mitzvah [mitzvah meal]. But to set a large meal there seems not right and one should only do so in a case of great need. And this is specifically the se'udat mitzvah of Torah study and not some other mitzvah like the meal of a bris or pidyon ha-ben or wedding. Those cannot take place in a beit midrash since they have no relevance to a beit midrash.
(טו) אין ישנים וכו' - ומיירי באנשים דעלמא אבל לת"ח כשלומד שם כבר ביארנו בסק"ו דשרי:
Don't sleep etc. - We are dealing with normal people, but for Torah scholars, we have already explained that it is permitted.
(טז) אבל בביהמ"ד מותר - ר"ל שינת עראי ועיין בחידושי רע"א שמפקפק בהיתר זה ואפשר דכיון שביהמ"ד עשוי לשהות שם זמן הרבה ללמוד ולשמוע דברי תורה וקשה ליזהר משינת עראי ע"כ לא אסרו זה לשום אדם. ולת"ח הלומד שם בקביעות מותר אפילו שינת קבע [כ"מ בלבוש]:


